Versions in this module Expand all Collapse all v3 v3.4.15 Feb 24, 2021 Changes in this version + const MaxLeaseTTL + const NoLease + var ErrLeaseExists = errors.New("lease already exists") + var ErrLeaseNotFound = errors.New("lease not found") + var ErrLeaseTTLTooLarge = errors.New("too large lease TTL") + var ErrNotPrimary = errors.New("not a primary lessor") + type Checkpointer func(ctx context.Context, lc *pb.LeaseCheckpointRequest) + type FakeLessor struct + func (fl *FakeLessor) Attach(id LeaseID, items []LeaseItem) error + func (fl *FakeLessor) Checkpoint(id LeaseID, remainingTTL int64) error + func (fl *FakeLessor) Demote() + func (fl *FakeLessor) Detach(id LeaseID, items []LeaseItem) error + func (fl *FakeLessor) ExpiredLeasesC() <-chan []*Lease + func (fl *FakeLessor) GetLease(item LeaseItem) LeaseID + func (fl *FakeLessor) Grant(id LeaseID, ttl int64) (*Lease, error) + func (fl *FakeLessor) Leases() []*Lease + func (fl *FakeLessor) Lookup(id LeaseID) *Lease + func (fl *FakeLessor) Promote(extend time.Duration) + func (fl *FakeLessor) Recover(b backend.Backend, rd RangeDeleter) + func (fl *FakeLessor) Renew(id LeaseID) (int64, error) + func (fl *FakeLessor) Revoke(id LeaseID) error + func (fl *FakeLessor) SetCheckpointer(cp Checkpointer) + func (fl *FakeLessor) SetRangeDeleter(dr RangeDeleter) + func (fl *FakeLessor) Stop() + type FakeTxnDelete struct + func (ftd *FakeTxnDelete) DeleteRange(key, end []byte) (n, rev int64) + func (ftd *FakeTxnDelete) End() + type Lease struct + ID LeaseID + func (l *Lease) Keys() []string + func (l *Lease) Remaining() time.Duration + func (l *Lease) RemainingTTL() int64 + func (l *Lease) TTL() int64 + type LeaseExpiredNotifier struct + func (mq *LeaseExpiredNotifier) Init() + func (mq *LeaseExpiredNotifier) Len() int + func (mq *LeaseExpiredNotifier) Poll() *LeaseWithTime + func (mq *LeaseExpiredNotifier) RegisterOrUpdate(item *LeaseWithTime) + func (mq *LeaseExpiredNotifier) Unregister() *LeaseWithTime + type LeaseID int64 + type LeaseItem struct + Key string + type LeaseQueue []*LeaseWithTime + func (pq *LeaseQueue) Pop() interface{} + func (pq *LeaseQueue) Push(x interface{}) + func (pq LeaseQueue) Len() int + func (pq LeaseQueue) Less(i, j int) bool + func (pq LeaseQueue) Swap(i, j int) + type LeaseWithTime struct + type Lessor interface + Attach func(id LeaseID, items []LeaseItem) error + Checkpoint func(id LeaseID, remainingTTL int64) error + Demote func() + Detach func(id LeaseID, items []LeaseItem) error + ExpiredLeasesC func() <-chan []*Lease + GetLease func(item LeaseItem) LeaseID + Grant func(id LeaseID, ttl int64) (*Lease, error) + Leases func() []*Lease + Lookup func(id LeaseID) *Lease + Promote func(extend time.Duration) + Recover func(b backend.Backend, rd RangeDeleter) + Renew func(id LeaseID) (int64, error) + Revoke func(id LeaseID) error + SetCheckpointer func(cp Checkpointer) + SetRangeDeleter func(rd RangeDeleter) + Stop func() + func NewLessor(lg *zap.Logger, b backend.Backend, cfg LessorConfig, ...) Lessor + type LessorConfig struct + CheckpointInterval time.Duration + ExpiredLeasesRetryInterval time.Duration + MinLeaseTTL int64 + type RangeDeleter func() TxnDelete + type TxnDelete interface + DeleteRange func(key, end []byte) (n, rev int64) + End func()