Atomic exact-product cache transactions.
The cache binds the complete distributor-independent product identity, the resolved distribution source, and digests and lengths for validated product, distributor archive, and provenance bytes. Native publication uses a bounded cross-process lock and one atomic reader-visible commit marker.
Transport and product-format validation remain caller responsibilities. A cache hit returns authenticated bytes; callers must still parse the product and interpret the authenticated provenance before use.
Summary
Functions
Abandons a single-flight acquisition without publishing.
Removes unreferenced transaction artifacts while the writer lock is held.
Reads a complete digest-verified entry through a lock-owning handle.
Reads a complete digest-verified entry without taking the writer lock.
Returns the shared cache protocol's control-directory name.
Requests an immediate liveness heartbeat from a single-flight owner.
Opens an exact cache with bounded single-flight acquisition.
Publishes validated bytes as one immutable transaction.
Runs an operation while holding the bounded cross-process writer lock.
Types
@type single_flight_open() :: {:hit, entry()} | {:owner, Sidereon.GNSS.ExactCache.Owner.t()}
@type single_flight_option() :: {:poll_interval_ms, pos_integer()} | {:heartbeat_interval_ms, pos_integer()} | {:liveness_timeout_ms, pos_integer()} | {:wait_timeout_ms, pos_integer()}
Functions
@spec abandon(Sidereon.GNSS.ExactCache.Owner.t()) :: :ok | {:error, term()}
Abandons a single-flight acquisition without publishing.
Removes unreferenced transaction artifacts while the writer lock is held.
Reads a complete digest-verified entry through a lock-owning handle.
@spec committed_files( String.t(), Sidereon.GNSS.Distribution.ProductIdentity.t(), atom() ) :: {:ok, entry()} | :miss | {:error, term()}
Reads a complete digest-verified entry without taking the writer lock.
@spec control_directory() :: String.t()
Returns the shared cache protocol's control-directory name.
@spec heartbeat(Sidereon.GNSS.ExactCache.Owner.t()) :: :ok | {:error, single_flight_error()}
Requests an immediate liveness heartbeat from a single-flight owner.
@spec open_single_flight( String.t(), Sidereon.GNSS.Distribution.ProductIdentity.t(), atom(), [ single_flight_option() ] ) :: single_flight_open() | {:error, single_flight_error()}
Opens an exact cache with bounded single-flight acquisition.
A {:hit, entry} result contains a complete digest-verified transaction and
the caller must not fetch. A {:owner, owner} result grants this caller the
exclusive right to fetch, validate, and publish through publish/4.
Timing options are positive integer milliseconds. Defaults are 50 ms for
:poll_interval_ms, 5 seconds for :heartbeat_interval_ms, 30 seconds for
:liveness_timeout_ms, and 30 minutes for :wait_timeout_ms. The heartbeat
interval must be shorter than the liveness timeout.
@spec publish( term() | Sidereon.GNSS.ExactCache.Owner.t(), binary(), binary(), binary() ) :: {:ok, entry()} | {:error, term()}
Publishes validated bytes as one immutable transaction.
@spec with_lock( String.t(), Sidereon.GNSS.Distribution.ProductIdentity.t(), atom(), non_neg_integer(), (term() -> result) ) :: result when result: term()
Runs an operation while holding the bounded cross-process writer lock.