Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLockTaken = errors.New("lock already taken") ErrLockNotExist = errors.New("lock does not exist") ErrReadLock = errors.New("could not read lock info") ErrRemoveLock = errors.New("could not remove lock") ErrEncodeMetadata = errors.New("could not encode metadata") ErrDecodeMetadata = errors.New("could not decode metadata") ErrWriteMetadata = errors.New("could not write metadata") ErrReadMetadata = errors.New("could not read metadata") ErrRemoveMetadata = errors.New("could not remove metadata") ErrGenNumberMismatch = errors.New("generation number mismatch") )
Functions ¶
This section is empty.
Types ¶
type FsLocker ¶
type FsLocker struct {
// contains filtered or unexported fields
}
func NewFsLocker ¶
type Locker ¶
type Locker interface { // Lock accepts a lock key as well as the TTL for the lock // and returns the generation number if lock was acquired or // an error otherwise Lock(key string, ttl time.Duration) (int64, error) // Refresh accepts a lock key as well as a generation number // and returns a new generation number if refresh was succesfull // or an error otherwise Refresh(key string, generation int64) (int64, error) // Release accepts a lock key as well as a generation number and // returns an error if lock release fails Release(key string, generation int64) error // Check if lock is expired and returns generation number that // should be used for lock release if it is expired Expired(key string) (int64, bool, error) }
Click to show internal directories.
Click to hide internal directories.