Documentation ¶
Index ¶
- Constants
- func PathJoin(elem ...string) string
- type LockContext
- type NsLockMap
- type OperationTimedOut
- type RWLocker
- type TRWMutex
- func (m *TRWMutex) ForceUnlock()
- func (m *TRWMutex) GetLock(ctx context.Context, timeout time.Duration) (locked bool)
- func (m *TRWMutex) GetRLock(ctx context.Context, timeout time.Duration) (locked bool)
- func (m *TRWMutex) Lock()
- func (m *TRWMutex) RLock()
- func (m *TRWMutex) RUnlock()
- func (m *TRWMutex) Unlock()
Constants ¶
const SlashSeparator = "/"
SlashSeparator - slash separator.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LockContext ¶
type LockContext struct {
// contains filtered or unexported fields
}
LockContext lock context holds the lock backed context and canceler for the context.
func (LockContext) Context ¶
func (l LockContext) Context() context.Context
Context returns lock context
type NsLockMap ¶
type NsLockMap struct {
// contains filtered or unexported fields
}
NsLockMap - namespace lock map, provides primitives to Lock, Unlock, RLock and RUnlock.
type OperationTimedOut ¶
type OperationTimedOut struct{}
OperationTimedOut - a timeout occurred.
func (OperationTimedOut) Error ¶
func (e OperationTimedOut) Error() string
type RWLocker ¶
type RWLocker interface { GetLock(ctx context.Context, timeout time.Duration) (lkCtx LockContext, timedOutErr error) Unlock(cancel context.CancelFunc) GetRLock(ctx context.Context, timeout time.Duration) (lkCtx LockContext, timedOutErr error) RUnlock(cancel context.CancelFunc) }
RWLocker - locker interface to introduce GetRLock, RUnlock.
type TRWMutex ¶
type TRWMutex struct {
// contains filtered or unexported fields
}
A TRWMutex is a mutual exclusion lock with timeouts.
func (*TRWMutex) ForceUnlock ¶
func (m *TRWMutex) ForceUnlock()
ForceUnlock will forcefully clear a write or read lock.
func (*TRWMutex) Lock ¶
func (m *TRWMutex) Lock()
Lock holds a write lock on lm.
If the lock is already in use, the calling go routine blocks until the mutex is available.
func (*TRWMutex) RLock ¶
func (m *TRWMutex) RLock()
RLock holds a read lock on lm.
If one or more read lock are already in use, it will grant another lock. Otherwise the calling go routine blocks until the mutex is available.