Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is an implementation of Store that is backed by a golang map. For testing purposes only.
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
NewInMemoryStore returns a new InMemoryStore instance.
type KubeLocker ¶
type KubeLocker struct {
// contains filtered or unexported fields
}
KubeLocker is an Locker that uses Kubernetes's leader election functionality for locking.
func NewKubeLocker ¶
func NewKubeLocker( kubeConfigPath string, id string, namespace string, ) (*KubeLocker, error)
NewKubeLocker returns a Locker that is backed by a lock in Kubernetes.
func (*KubeLocker) Acquire ¶
func (k *KubeLocker) Acquire(ctx context.Context, name string) error
Acquire acquires a lock with the argument name.
func (*KubeLocker) Release ¶
func (k *KubeLocker) Release(name string) error
Release releases the lock with the argument name.
type KubeStore ¶
type KubeStore struct {
// contains filtered or unexported fields
}
KubeStore is an implementation of Store that is backed by a Kubernetes configMap.
func NewKubeStore ¶
NewKubeStore returns a new KubeStore instance.
type LocalLocker ¶
type LocalLocker struct {
// contains filtered or unexported fields
}
LocalLocker is an implementation of Locker that keeps track of locks in memory. For testing purposes only.
func NewLocalLocker ¶
func NewLocalLocker() *LocalLocker
NewLocalLocker returns a new LocalLocker instance, which is backed by a golang lock.
func (*LocalLocker) Acquire ¶
func (l *LocalLocker) Acquire(ctx context.Context, name string) error
Acquire acquires the lock with the argument name.
func (*LocalLocker) Release ¶
func (l *LocalLocker) Release(name string) error
Release releases the lock with the argument name.
type Locker ¶
type Locker interface { // Acquire acquires the lock with the provided name. Acquire(ctx context.Context, name string) error // Release releases the lock with the provided name. Release(name string) error }
Locker is an interface for structs that can acquire and release locks.
type Store ¶
type Store interface { // Get gets the value of the argument key. Get(ctx context.Context, key string) (string, error) // Set sets the provided key/value pair. Set(ctx context.Context, key string, value string) error }
Store is an interface for structs that can get and set key/value pairs.
Directories ¶
Path | Synopsis |
---|---|
Package leaderelection implements leader election of a set of endpoints.
|
Package leaderelection implements leader election of a set of endpoints. |