Versions in this module Expand all Collapse all v0 v0.1.1 Mar 17, 2023 v0.1.0 Oct 4, 2021 Changes in this version + const DistributedLockLeaseRenewPeriodSeconds + const DistributedLockLeaseTTLSeconds + const DistributedLockPollRetryPeriodSeconds + const DistributedOptimisticLockingRetryPeriodSeconds + var ErrLockAlreadyLeased = errors.New("lock already leased") + var ErrNoExistingLockLeaseFound = errors.New("no existing lock lease found") + var ErrShouldWait = errors.New("should wait") + func IsErrLockAlreadyLeased(err error) bool + func IsErrNoExistingLockLeaseFound(err error) bool + func IsErrShouldWait(err error) bool + func RunHttpBackendServer(ip, port string, backend DistributedLockerBackend) error + type AcquireOptions struct + Shared bool + type AcquireRequest struct + LockName string + Opts AcquireOptions + type AcquireResponse struct + Err util.SerializableError + LockHandle lockgate.LockHandle + type DistributedLocker struct + Backend DistributedLockerBackend + func NewDistributedLocker(backend DistributedLockerBackend) *DistributedLocker + func NewHttpLocker(urlEndpoint string) *DistributedLocker + func NewKubernetesLocker(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, ...) *DistributedLocker + func (l *DistributedLocker) Acquire(lockName string, opts lockgate.AcquireOptions) (bool, lockgate.LockHandle, error) + func (l *DistributedLocker) Release(handle lockgate.LockHandle) error + type DistributedLockerBackend interface + Acquire func(lockName string, opts AcquireOptions) (lockgate.LockHandle, error) + Release func(handle lockgate.LockHandle) error + RenewLease func(handle lockgate.LockHandle) error + type HttpBackend struct + HttpClient *http.Client + URLEndpoint string + func NewHttpBackend(urlEndpoint string) *HttpBackend + func (backend *HttpBackend) Acquire(lockName string, opts AcquireOptions) (lockgate.LockHandle, error) + func (backend *HttpBackend) Release(handle lockgate.LockHandle) error + func (backend *HttpBackend) RenewLease(handle lockgate.LockHandle) error + type HttpBackendHandler struct + Backend DistributedLockerBackend + func NewHttpBackendHandler(backend DistributedLockerBackend) *HttpBackendHandler + func NewHttpBackendHandlerWithInMemoryStore() *HttpBackendHandler + func NewHttpBackendHandlerWithKubernetesStore(kubernetesInterface dynamic.Interface, gvr schema.GroupVersionResource, ...) *HttpBackendHandler + type LeaseRenewWorkerDescriptor struct + DoneChan chan struct{} + SharedLeaseCounter int64 + type LockLeaseRecord struct + ExpireAtTimestamp int64 + IsShared bool + SharedHoldersCount int64 + func NewLockLeaseRecord(lockName string, isShared bool) *LockLeaseRecord + type OptimisticLockingStorageBasedBackend struct + Store optimistic_locking_store.OptimisticLockingStore + func NewOptimisticLockingStorageBasedBackend(store optimistic_locking_store.OptimisticLockingStore) *OptimisticLockingStorageBasedBackend + func (backend *OptimisticLockingStorageBasedBackend) Acquire(lockName string, opts AcquireOptions) (lockgate.LockHandle, error) + func (backend *OptimisticLockingStorageBasedBackend) Release(handle lockgate.LockHandle) error + func (backend *OptimisticLockingStorageBasedBackend) RenewLease(handle lockgate.LockHandle) error + type ReleaseRequest struct + LockHandle lockgate.LockHandle + type ReleaseResponse struct + Err util.SerializableError + type RenewLeaseRequest struct + LockHandle lockgate.LockHandle + type RenewLeaseResponse struct + Err util.SerializableError