Versions in this module Expand all Collapse all v1 v1.1.1 Dec 7, 2024 v1.1.0 Dec 7, 2024 Changes in this version + var ErrEmptyName = errors.New("lock name cannot be empty") + var ErrInvalidLockTimeout = errors.New("lock timeout must be greater than 0") + var ErrInvalidWaitTimeout = errors.New("wait timeout must be greater than 0") + var ErrLockDoesNotExistOrInvalidKey = errors.New("lock does not exist or invalid key") + var ErrLockWaitTimeout = errors.New("timeout waiting to acquire lock") + var ErrSessionDoesNotExist = errors.New("session does not exist") + type Lock struct + Key string + Locked bool + Name string + type LockServer struct + func New(c *LockServerConfig) (*LockServer, func(), error) + func (l *LockServer) CreateSession(ctx context.Context, sessionInfo map[string]any) (string, context.Context) + func (l *LockServer) DestroySession(ctx context.Context) (sessionId string) + func (l *LockServer) Lock(ctx context.Context, name string, size *int32, lockTimeoutSeconds *int32, ...) (*Lock, error) + func (l *LockServer) Locks() []cl.Lock + func (l *LockServer) RefreshLock(ctx context.Context, name string, key string, lockTimeoutSeconds int32) (*Lock, error) + func (l *LockServer) SessionId(ctx context.Context) (string, bool) + func (l *LockServer) TryLock(ctx context.Context, name string, size *int32, lockTimeoutSeconds *int32) (*Lock, error) + func (l *LockServer) Unlock(ctx context.Context, name string, key string) (bool, error) + type LockServerConfig struct + DefaultLockTimeout time.Duration + LockGcInterval time.Duration + LockGcMinIdle time.Duration + NoClearOnDisconnect bool + Shards uint32 v1.0.0 Apr 23, 2024 Changes in this version + func Run(conf *ServerConfig) (func(), error) + type ServerConfig struct + ClientCA string + ClientCertVerify bool + KeepaliveInterval time.Duration + KeepaliveTimeout time.Duration + ListenAddress string + Password string + TlsCert string + TlsKey string