MCPcopy Create free account
hub / github.com/Shopify/goose / LockMap

Interface LockMap

lockmap/map.go:14–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12type PromiseMap map[interface{}]Promise
13
14type LockMap interface {
15 // Wait returns the Promise for a key.
16 // If the Promise is expired, it will be resolved, but this function will return nil
17 Wait(key interface{}) Promise
18
19 // WaitOrLock takes the lock, but only if none exists for that key.
20 // If the Promise is expired, it will successfully replace it and the previous Promise will be resolved.
21 WaitOrLock(key interface{}, ttl time.Duration) (promise Promise, gotLock bool)
22
23 // Release unlocks a key and resolved the previous Promise, if any.
24 Release(key interface{})
25
26 // Allows the LockMap to be started and stopped externally
27 Tomb() *tomb.Tomb
28 Run() error
29}
30
31func New(sweepInterval time.Duration, tomb *tomb.Tomb) LockMap {
32 return &lockMap{

Callers 28

TestCond_BroadcastFunction · 0.65
TestCond_Signal_randomFunction · 0.65
Test_lockMap_ReleaseFunction · 0.65
Test_lockMap_WaitFunction · 0.65
Test_lockMap_sweepFunction · 0.65
BenchmarkLimiterFunction · 0.65
ExampleNewFunction · 0.65
Test_lockMap_ReleaseFunction · 0.65
Test_lockMap_WaitFunction · 0.65
Test_lockMap_WaitOrLockFunction · 0.65
Test_lockMap_sweepFunction · 0.65
ExampleNewFunction · 0.65

Implementers 1

lockMaplockmap/map.go

Calls

no outgoing calls

Tested by

no test coverage detected