Documentation ¶
Overview ¶
Package mortise implement a lock service based ob redis with fencing guarantee
Index ¶
- type ErrMutexOccupied
- type ErrOutdatedToken
- type ErrRedis
- type MutexManager
- func (m *MutexManager) CheckCurrentFencingToken(key string, givenToken int64) (bool, error)
- func (m *MutexManager) GetCurrentFencingToken(key string) (int64, error)
- func (m *MutexManager) Lock(key string, expiredTime time.Duration) (int64, error)
- func (m *MutexManager) Unlock(key string, fencingToken int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrMutexOccupied ¶
type ErrMutexOccupied struct {
// contains filtered or unexported fields
}
mutex has been acquired and still not release
func (*ErrMutexOccupied) Error ¶
func (e *ErrMutexOccupied) Error() string
type ErrOutdatedToken ¶
type ErrOutdatedToken struct {
// contains filtered or unexported fields
}
fencing token outdated
func (*ErrOutdatedToken) Error ¶
func (e *ErrOutdatedToken) Error() string
type ErrRedis ¶
type ErrRedis struct {
// contains filtered or unexported fields
}
redis internal error
type MutexManager ¶
type MutexManager struct { Conn redis.Conn Name string // shall be genaral unique // contains filtered or unexported fields }
Mutex manager to del with full lock process
func (*MutexManager) CheckCurrentFencingToken ¶
func (m *MutexManager) CheckCurrentFencingToken(key string, givenToken int64) (bool, error)
compare lock token and given token
func (*MutexManager) GetCurrentFencingToken ¶
func (m *MutexManager) GetCurrentFencingToken(key string) (int64, error)
check current fencing token
Click to show internal directories.
Click to hide internal directories.