Sidereon.GNSS.ExactCache (Sidereon v0.30.0)

Copy Markdown View Source

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

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.

Publishes validated bytes as one immutable transaction.

Runs an operation while holding the bounded cross-process writer lock.

Types

entry()

@type entry() :: %{
  product: String.t(),
  archive: String.t(),
  provenance: String.t(),
  entry_id: String.t(),
  product_bytes: binary(),
  archive_bytes: binary(),
  provenance_bytes: binary()
}

Functions

cleanup_abandoned(cache)

@spec cleanup_abandoned(term()) :: :ok | {:error, term()}

Removes unreferenced transaction artifacts while the writer lock is held.

committed_files(cache)

@spec committed_files(term()) :: {:ok, entry()} | :miss | {:error, term()}

Reads a complete digest-verified entry through a lock-owning handle.

committed_files(path, identity, source)

@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.

control_directory()

@spec control_directory() :: String.t()

Returns the shared cache protocol's control-directory name.

publish(cache, content, archive, provenance)

@spec publish(term(), binary(), binary(), binary()) ::
  {:ok, entry()} | {:error, term()}

Publishes validated bytes as one immutable transaction.

with_lock(path, identity, source, timeout_ms \\ 30000, operation)

@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.