MCPcopy
hub / github.com/dropbox/godropbox / LockStore

Interface LockStore

container/concurrent/lockstore/store.go:15–35  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

13// This is mainly use to provide different levels of granularity to avoid
14// lock contention
15type 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

Callers

nothing calls this directly

Implementers 3

_LockStoreImpcontainer/concurrent/lockstore/store.g
FileLocksys/filelock/filelock.go
_LockStoreImplockstore/store.go

Calls

no outgoing calls

Tested by

no test coverage detected