Documentation
¶
Overview ¶
Package lock provides distributed lock interface.
Implementations include: * MySQL GET_LOCK() based distributed locking
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock interface {
// Try to acquire a lock. Returns false if failed.
TryLock(s string) bool
// Allows n simultaneous locks to be held
TryLockShared(s string, n int) bool
// Try to acquire a lock and wait for specified period of time for the lock
// to become available. Returns false if failed.
Lock(s string, waitDuration time.Duration) bool
// Check if we still have the lock. Try to reacquire if necessary.
// Returns false in the case of failure
Refresh() bool
// Unlock the lock. Returns false if there was failure
Unlock() bool
//Close releases resources associated with the lock
Close() bool
}
Lock is general distributed lock interface
Click to show internal directories.
Click to hide internal directories.