etcd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEtcdClient

func NewEtcdClient(
	ctx context.Context,
	conf *v1alpha1.EtcdClientSpec,
) (*clientv3.Client, error)

func NewEtcdMutex

func NewEtcdMutex(
	lg *slog.Logger,
	prefix, key string,
	session *concurrency.Session,
	opts *lock.LockOptions,
) etcdMutex

Types

type EtcdLock

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

func NewEtcdLock

func NewEtcdLock(
	lg *slog.Logger,
	client *clientv3.Client,
	prefix, key string,
	options *lock.LockOptions,
) *EtcdLock

func (*EtcdLock) Key

func (e *EtcdLock) Key() string

func (*EtcdLock) Lock

func (e *EtcdLock) Lock(ctx context.Context) (<-chan struct{}, error)

func (*EtcdLock) TryLock

func (e *EtcdLock) TryLock(ctx context.Context) (acquired bool, done <-chan struct{}, err error)

func (*EtcdLock) Unlock

func (e *EtcdLock) Unlock() error

type EtcdLockManager

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

func NewEtcdLockManager

func NewEtcdLockManager(
	client *clientv3.Client,
	prefix string,
	tracer trace.Tracer,
	lg *slog.Logger,
) *EtcdLockManager

func (*EtcdLockManager) Health

func (e *EtcdLockManager) Health(ctx context.Context) (conditions []string, err error)

func (*EtcdLockManager) NewLock

func (e *EtcdLockManager) NewLock(key string, opts ...lock.LockOption) lock.Lock

!! Cannot reuse *concurrency.Session across multiple locks since it will break liveliness guarantee A locks will share their sessions and therefore keepalives will be sent for all locks, not just a specific lock. In the current implementation sessions are forcibly orphaned when the non-blocking call to unlock is made so we cannot re-use sessions in that case either -- since the session will be orphaned for all locks if the session is re-used.

Jump to

Keyboard shortcuts

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