Persistence helpers for app-state hash-chain metadata.
The app-state protocol tracks a per-collection LTHash version and a mutation MAC cache. This module keeps those storage concerns separate from transport and decoding logic.
Summary
Functions
Returns the collection names tracked by the app-state engine.
Loads the saved hash state and mutation MACs for one collection.
Persists the current hash state and mutation MACs for one collection.
Drops a collection's stored version, hash and mutation MACs so the next fetch starts over from a snapshot.
Types
@type hash_state() :: %{version: non_neg_integer(), hash: binary()}
Functions
@spec all_collections() :: [String.t()]
Returns the collection names tracked by the app-state engine.
@spec get_collection_state( struct(), String.t() ) :: {:ok, hash_state(), map()}
Loads the saved hash state and mutation MACs for one collection.
@spec persist_collection_state(struct(), String.t(), hash_state(), map()) :: :ok
Persists the current hash state and mutation MACs for one collection.
Drops a collection's stored version, hash and mutation MACs so the next fetch starts over from a snapshot.