etcd

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdBackend

type EtcdBackend struct {
	// contains filtered or unexported fields
}

func NewEtcdBackend

func NewEtcdBackend(cfg EtcdConfig) (*EtcdBackend, error)

func (*EtcdBackend) Close

func (e *EtcdBackend) Close() error

Calls all necessary finalization if necessary

func (*EtcdBackend) GetLocks

func (e *EtcdBackend) GetLocks(group string) (int, error)

Returns the current number of locks for the given group

func (*EtcdBackend) GetStaleLocks

func (e *EtcdBackend) GetStaleLocks(ts time.Duration) ([]types.Lock, error)

Return all locks older than x

func (*EtcdBackend) HasLock

func (e *EtcdBackend) HasLock(group string, id string) (bool, error)

Check if a given id already has a lock for this group

func (*EtcdBackend) Release

func (e *EtcdBackend) Release(group string, id string) error

Release the lock currently held by the id. Does not fail when no lock is held.

func (*EtcdBackend) Reserve

func (e *EtcdBackend) Reserve(group string, id string) error

Reserve a lock for the given group. Returns true if the lock is successfully reserved, even if the lock is already held by the specific id

type EtcdConfig

type EtcdConfig struct {
	Endpoints []string `yaml:"endpoints,omitempty"`
	Username  string   `yaml:"username,omitempty"`
	Password  string   `yaml:"password,omitempty"`
	CertFile  string   `yaml:"cert,omitempty"`
	KeyFile   string   `yaml:"key,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL