Documentation
¶
Index ¶
- Variables
- func Capabilities() map[string]Capability
- func Check(args ...base.Any) (bool, error)
- func CheckOn(conn string, args ...base.Any) (bool, error)
- func Key(args ...base.Any) string
- func KeyWith(sep string, args ...base.Any) string
- func Lock(args ...base.Any) (*locker, error)
- func LockOn(conn string, args ...base.Any) (*locker, error)
- func Locked(args ...base.Any) bool
- func LockedOn(conn string, args ...base.Any) bool
- func Refresh(args ...base.Any) error
- func RefreshOn(conn string, args ...base.Any) error
- func ResetStats()
- func TryLock(args ...base.Any) (*locker, error)
- func TryLockOn(conn string, args ...base.Any) (*locker, error)
- func Unlock(args ...base.Any) error
- func UnlockOn(conn string, args ...base.Any) error
- func WaitLock(timeout, interval time.Duration, args ...base.Any) (*locker, error)
- func WaitLockContext(ctx context.Context, interval time.Duration, args ...base.Any) (*locker, error)
- func WaitLockOn(conn string, timeout, interval time.Duration, args ...base.Any) (*locker, error)
- func WaitLockOnContext(conn string, ctx context.Context, interval time.Duration, args ...base.Any) (*locker, error)
- type Capability
- type CapabilityProvider
- type Checker
- type Config
- type Configs
- type Connection
- type ContentionStat
- type DebugInfo
- type DebugInstance
- type DebugToken
- type DebugTokenEntry
- type Driver
- type Instance
- type Module
- func (m *Module) Capabilities() map[string]Capability
- func (m *Module) CapabilityFrom(conn string) (Capability, error)
- func (m *Module) Close()
- func (m *Module) Config(global base.Map)
- func (m *Module) Debug() DebugInfo
- func (m *Module) DebugTokens() []DebugToken
- func (m *Module) Lock(key string, expires ...time.Duration) error
- func (m *Module) LockOn(conn string, key string, expires ...time.Duration) error
- func (m *Module) Locked(key string) (bool, error)
- func (m *Module) LockedOn(conn, key string) (bool, error)
- func (m *Module) Open()
- func (m *Module) Refresh(key string, expires ...time.Duration) error
- func (m *Module) RefreshOn(conn, key string, expires ...time.Duration) error
- func (m *Module) Register(name string, value base.Any)
- func (m *Module) RegisterConfig(name string, cfg Config)
- func (m *Module) RegisterConfigs(configs Configs)
- func (m *Module) RegisterDriver(name string, driver Driver)
- func (m *Module) ResetStats()
- func (m *Module) Setup()
- func (m *Module) Start()
- func (m *Module) Stats() Statistics
- func (m *Module) StatsFrom(conn string) (Statistics, error)
- func (m *Module) Stop()
- func (m *Module) Unlock(key string) error
- func (m *Module) UnlockOn(conn, key string) error
- type Refresher
- type Statistics
- type TokenConnection
- type TokenRefresher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidConnection = errors.New("invalid mutex connection") ErrNotReady = errors.New("mutex is not ready") ErrClosed = errors.New("mutex is closed") ErrLocked = errors.New("mutex already locked") ErrLostLock = errors.New("mutex lock is lost") ErrTimeout = errors.New("mutex timeout") ErrInvalidLease = errors.New("invalid mutex lease") ErrUnsupportedCheck = errors.New("mutex locked check is unsupported") ErrUnsupportedRefresh = errors.New("mutex refresh is unsupported") ErrTokenRequired = errors.New("mutex unlock requires token") )
Functions ¶
func Capabilities ¶ added in v0.26.0
func Capabilities() map[string]Capability
func ResetStats ¶ added in v0.26.0
func ResetStats()
func WaitLockContext ¶ added in v0.26.0
func WaitLockOn ¶ added in v0.26.0
Types ¶
type Capability ¶ added in v0.26.0
func CapabilityFrom ¶ added in v0.26.0
func CapabilityFrom(conn string) (Capability, error)
type CapabilityProvider ¶ added in v0.26.0
type CapabilityProvider interface {
Capabilities() Capability
}
type Connection ¶ added in v0.7.0
type Connection interface {
Open() error
Close() error
Lock(key string, expires time.Duration) error
Unlock(key string) error
}
Connection defines a mutex connection.
type ContentionStat ¶ added in v0.26.0
type DebugInfo ¶ added in v0.26.0
type DebugInfo struct {
Opened bool
Started bool
CleanupInterval time.Duration
Instances map[string]DebugInstance
Tokens []DebugToken
Stats Statistics
}
type DebugInstance ¶ added in v0.26.0
type DebugToken ¶ added in v0.26.0
type DebugToken struct {
Conn string
Key string
Count int
Active int
Expired int
Entries []DebugTokenEntry
}
func DebugTokens ¶ added in v0.26.0
func DebugTokens() []DebugToken
type DebugTokenEntry ¶ added in v0.26.0
type Driver ¶
type Driver interface {
Connect(*Instance) (Connection, error)
}
Driver defines a mutex driver.
type Instance ¶
type Instance struct {
Name string
Config Config
Setting base.Map
// contains filtered or unexported fields
}
Instance is the driver instance context.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) Capabilities ¶ added in v0.26.0
func (m *Module) Capabilities() map[string]Capability
func (*Module) CapabilityFrom ¶ added in v0.26.0
func (m *Module) CapabilityFrom(conn string) (Capability, error)
func (*Module) DebugTokens ¶ added in v0.26.0
func (m *Module) DebugTokens() []DebugToken
func (*Module) LockedOn ¶ added in v0.26.0
LockedOn checks lock status on a specific connection without mutating it.
func (*Module) Refresh ¶ added in v0.26.0
Refresh refreshes a lock lease with auto-selected connection.
func (*Module) RefreshOn ¶ added in v0.26.0
RefreshOn refreshes a lock lease on a specific connection.
func (*Module) RegisterConfig ¶ added in v0.7.0
RegisterConfig registers a named mutex config.
func (*Module) RegisterConfigs ¶ added in v0.7.0
RegisterConfigs registers multiple named mutex configs.
func (*Module) RegisterDriver ¶ added in v0.7.0
RegisterDriver registers a mutex driver.
func (*Module) ResetStats ¶ added in v0.26.0
func (m *Module) ResetStats()
func (*Module) Stats ¶ added in v0.26.0
func (m *Module) Stats() Statistics
func (*Module) StatsFrom ¶ added in v0.26.0
func (m *Module) StatsFrom(conn string) (Statistics, error)
type Statistics ¶ added in v0.26.0
type Statistics struct {
Lock uint64
Unlock uint64
Refresh uint64
Check uint64
Contention uint64
Error uint64
Cleanup uint64
ActiveTokens int
ContentionByKey map[string]uint64
ContentionByPrefix map[string]uint64
HotKeys []ContentionStat
Instances map[string]Statistics
}
func Stats ¶ added in v0.26.0
func Stats() Statistics
func StatsFrom ¶ added in v0.26.0
func StatsFrom(conn string) (Statistics, error)
type TokenConnection ¶ added in v0.26.0
Click to show internal directories.
Click to hide internal directories.