Documentation
¶
Overview ¶
Package proclock is a cross-process advisory file lock used to single-flight credential refreshes across cooperating processes.
The lock file holds no data — it exists only as a flock(2) / LockFileEx handle. The advisory lock is released automatically when the holding process exits, so a crashed holder never wedges the lock permanently (the property a hand-rolled O_EXCL lockfile lacks).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
FileLock is an advisory lock keyed to a filesystem path. Construct one per (path) with New. A FileLock is safe to reuse across Acquire calls but a single FileLock value must not be Acquired re-entrantly.
func New ¶
New returns a FileLock for path. The file and its parent directory are created lazily on Acquire.
func (*FileLock) Acquire ¶
Acquire blocks until the exclusive lock is held or ctx is done. It returns an idempotent release func; call it to release the lock and close the underlying handle. Acquire applies defaultAcquireTimeout as a ceiling: if ctx already carries an earlier deadline, that deadline wins.