LockStore provides a way to synchronize using locks based on keys This is mainly use to provide different levels of granularity to avoid lock contention
| 13 | // This is mainly use to provide different levels of granularity to avoid |
| 14 | // lock contention |
| 15 | type LockStore interface { |
| 16 | // Lock locks the mutex that is used for the given key |
| 17 | Lock(key string) |
| 18 | |
| 19 | // TryLock attempts to acquire the lock given the timeout. Returns |
| 20 | // true if it successfully acquire the lock. False otherwise |
| 21 | TryLock(key string, timeout time.Duration) (success bool) |
| 22 | |
| 23 | // Unlock unlocks the mutex that is used for the given key |
| 24 | Unlock(key string) |
| 25 | |
| 26 | // RLock locks the mutex for read-only that is used for the given key |
| 27 | RLock(key string) |
| 28 | |
| 29 | // TryRLock attempts to acquire the reader lock given the timeout. Returns |
| 30 | // true if it successfully acquire the lock. False otherwise |
| 31 | TryRLock(key string, timeout time.Duration) (success bool) |
| 32 | |
| 33 | // RUnlock unlocks the mutex for read-only that is used for the given key |
| 34 | RUnlock(key string) |
| 35 | } |
| 36 | |
| 37 | // Specifies locking granularity... |
| 38 | // Is it one per key, per few keys, per the whole store |
nothing calls this directly
no outgoing calls
no test coverage detected