mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-23 13:00:08 +08:00
Mutex hat pattern
This commit is contained in:
parent
7e3363eeb4
commit
b550e5b2c6
@ -207,10 +207,11 @@ type ttlentry struct {
|
|||||||
type ttlmanager struct {
|
type ttlmanager struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
entries map[ds.Key]*ttlentry
|
entries map[ds.Key]*ttlentry
|
||||||
ctx context.Context
|
|
||||||
cancel context.CancelFunc
|
ctx context.Context
|
||||||
ticker *time.Ticker
|
cancel context.CancelFunc
|
||||||
ds ds.Datastore
|
ticker *time.Ticker
|
||||||
|
ds ds.Datastore
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTTLManager(parent context.Context, d ds.Datastore, tick time.Duration) *ttlmanager {
|
func newTTLManager(parent context.Context, d ds.Datastore, tick time.Duration) *ttlmanager {
|
||||||
|
Loading…
Reference in New Issue
Block a user