add TTL to consul lock using store.LockOptions and add tests for the Lock ttl behavior
Signed-off-by: Alexandre Beslic <abronan@docker.com>
This commit is contained in:
parent
1de5aa45ce
commit
7225aba3af
1 changed files with 4 additions and 3 deletions
|
@ -113,13 +113,14 @@ type WriteOptions struct {
|
|||
|
||||
// LockOptions contains optional request parameters
|
||||
type LockOptions struct {
|
||||
Value []byte // Optional, value to associate with the lock
|
||||
TTL time.Duration // Optional, expiration ttl associated with the lock
|
||||
Value []byte // Optional, value to associate with the lock
|
||||
TTL time.Duration // Optional, expiration ttl associated with the lock
|
||||
RenewLock chan struct{} // Optional, chan used to control and stop the session ttl renewal for the lock
|
||||
}
|
||||
|
||||
// Locker provides locking mechanism on top of the store.
|
||||
// Similar to `sync.Lock` except it may return errors.
|
||||
type Locker interface {
|
||||
Lock() (<-chan struct{}, error)
|
||||
Lock(stopChan chan struct{}) (<-chan struct{}, error)
|
||||
Unlock() error
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue