Versions in this module Expand all Collapse all v0 v0.0.1 May 29, 2021 Changes in this version + var ErrDecodeMetadata = errors.New("could not decode metadata") + var ErrEncodeMetadata = errors.New("could not encode metadata") + var ErrGenNumberMismatch = errors.New("generation number mismatch") + var ErrLockNotExist = errors.New("lock does not exist") + var ErrLockTaken = errors.New("lock already taken") + var ErrReadLock = errors.New("could not read lock info") + var ErrReadMetadata = errors.New("could not read metadata") + var ErrRemoveLock = errors.New("could not remove lock") + var ErrRemoveMetadata = errors.New("could not remove metadata") + var ErrWriteMetadata = errors.New("could not write metadata") + type FsLocker struct + func NewFsLocker(rootDir string) (*FsLocker, error) + func (fs *FsLocker) Expired(key string) (int64, bool, error) + func (fs *FsLocker) Lock(key string, ttl time.Duration) (int64, error) + func (fs *FsLocker) Refresh(key string, generation int64) (int64, error) + func (fs *FsLocker) Release(key string, generation int64) error + type Locker interface + Expired func(key string) (int64, bool, error) + Lock func(key string, ttl time.Duration) (int64, error) + Refresh func(key string, generation int64) (int64, error) + Release func(key string, generation int64) error + type Metadata struct + Expires int64 + TTL int64 + func NewMetadata(ttl time.Duration) *Metadata + func ParseMetadata(data []byte) (*Metadata, error) + func (md *Metadata) Encode() ([]byte, error)