Expand description
Monotonic ULID allocator backed by an advisory file lock.
allocate(lock_path) returns a Ulid strictly greater than every
prior ULID minted at the same lock path, across processes. The
run_id = <pipe>-<lowercase-ulid> composition (plan R4) lives at
the call site; this module returns the raw Ulid.
Cross-process ordering uses fs2 advisory exclusive locks on the
lock file itself. Default acquire budget is 5s; exceeding yields
Error::LockTimeout { path } (surfaced by CliError::UlidLockTimeout).
Monotonicity under clock skew: if Ulid::new() produces a value not
strictly greater than the persisted ULID (host clock ran backward, or
two calls within the same millisecond happen to land with a smaller
random field), we bump the persisted value via Ulid::increment() and
return that instead.
Enums§
Constants§
- DEFAULT_
LOCK_ TIMEOUT - Default budget for acquiring the advisory lock on the lock file.
Functions§
- allocate
- Allocate a strictly-monotonic ULID using the default 5s lock budget.
- allocate_
with_ timeout - Allocate with an explicit lock-acquisition timeout. Used by tests.