Versions in this module Expand all Collapse all v0 v0.1.0 Nov 17, 2020 Changes in this version + const LOCK_TYPE_EXCLUSIVE + const LOCK_TYPE_SHARED + var ErrAlreadyLocked = errors.New("unable to acquire lock (resource is already locked)") + var ErrLockNotFound = errors.New("unable to find lock") + var ReturnDoc = options.After + var UPSERT = true + type Client struct + func NewClient(collection *mongo.Collection) *Client + func (c *Client) CreateIndexes(ctx context.Context) error + func (c *Client) Renew(ctx context.Context, lockId string, ttl uint) ([]LockStatus, error) + func (c *Client) SLock(ctx context.Context, resourceName, lockId string, ld LockDetails, ...) error + func (c *Client) Status(ctx context.Context, f Filter) ([]LockStatus, error) + func (c *Client) Unlock(ctx context.Context, lockId string) ([]LockStatus, error) + func (c *Client) XLock(ctx context.Context, resourceName, lockId string, ld LockDetails) error + type Filter struct + CreatedAfter time.Time + CreatedBefore time.Time + LockId string + Owner string + Resource string + TTLgte uint + TTLlt uint + type LockDetails struct + Host string + Owner string + TTL uint + type LockStatus struct + CreatedAt time.Time + Host string + LockId string + Owner string + RenewedAt *time.Time + Resource string + TTL int64 + Type string + type LockStatusesByCreatedAtDesc []LockStatus + func (ls LockStatusesByCreatedAtDesc) Len() int + func (ls LockStatusesByCreatedAtDesc) Less(i, j int) bool + func (ls LockStatusesByCreatedAtDesc) Swap(i, j int) + type Purger interface + Purge func(ctx context.Context) ([]LockStatus, error) + func NewPurger(client *Client) Purger