Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LockTTL = 10 * time.Second
LockTTL defines max time to live of a lock.
View Source
var WaitForLock = 5 * time.Second
WaitForLock defines the about of time to wait to acquire a lock
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock provides lock functionalities based on consul sessions.It implements The Lock interface.
func NewLockWithTTL ¶
NewLockWithTTL creates a consul lock instance
func (*Lock) Acquire ¶
Acquire acquires a lock. Returns error if it failed to acquire the lock. If the lock object has a session that is still tired to the locked key, nil is returned.
func (*Lock) IsAcquirer ¶
IsAcquirer checks whether this lock instance is the acquirer of the lock on a specific key
Click to show internal directories.
Click to hide internal directories.