MCPcopy
hub / github.com/caddyserver/certmagic / Locker

Interface Locker

storage.go:129–151  ·  view source on GitHub ↗

Locker facilitates synchronization across machines and networks. It essentially provides a distributed named-mutex service so that multiple consumers can coordinate tasks and share resources. If possible, a Locker should implement a coordinated distributed locking mechanism by generating fencing to

Source from the content-addressed store, hash-verified

127// operations across nodes in a cluster; not for internal, extremely
128// short-lived, or high-contention locks.
129type Locker interface {
130 // Lock acquires the lock for name, blocking until the lock
131 // can be obtained or an error is returned. Only one lock
132 // for the given name can exist at a time. A call to Lock for
133 // a name which already exists blocks until the named lock
134 // is released or becomes stale.
135 //
136 // If the named lock represents an idempotent operation, callers
137 // should always check to make sure the work still needs to be
138 // completed after acquiring the lock. You never know if another
139 // process already completed the task while you were waiting to
140 // acquire it.
141 //
142 // Implementations should honor context cancellation.
143 Lock(ctx context.Context, name string) error
144
145 // Unlock releases named lock. This method must ONLY be called
146 // after a successful call to Lock, and only after the critical
147 // section is finished, even if it errored or timed out. Unlock
148 // cleans up any resources allocated during Lock. Unlock should
149 // only return an error if the lock was unable to be released.
150 Unlock(ctx context.Context, name string) error
151}
152
153type TryLocker interface {
154 // TryLock attempts to acquire the lock for name, and returns a

Callers 16

HTTPSFunction · 0.65
PresentMethod · 0.65
CleanUpMethod · 0.65
PresentMethod · 0.65
CleanUpMethod · 0.65
saveDNSPresentMemoryMethod · 0.65
getDNSPresentMemoryMethod · 0.65
HTTPSFunction · 0.65
PresentMethod · 0.65
CleanUpMethod · 0.65
PresentMethod · 0.65

Implementers 3

memoryStorageaccount_test.go
recordingStorageaccount_test.go
FileStoragefilestorage.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…