The desired-state store seam: Tank's view of the [:tank, :pods, …] subtree
of a Khepri store.
Bring-your-own-or-default
Tank is a library, so it never owns a store's cluster lifecycle. Which side
starts Khepri is chosen by the :data_dir option:
:data_dirset — Tank boots a default store at that directory and owns it (standalone, dev, tests).:data_dirnil— the store named by:store_idis assumed to be started by the consumer; Tank only attaches its projection.
Either way Tank registers a khepri_projection mirroring [:tank, :pods, **]
into the ETS table :tank_pods, so list_pods/0 is a fast local
read (the substrate the reconciler will watch). Single-pod reads go straight
to Khepri so they are authoritative.
Pods are stored as %Tank.Pod{} structs at [:tank, :pods, name].
Summary
Functions
Supervisor child spec for the store seam.
Write a pod only if it does not already exist (the create-if-absent seed
path). Returns {:error, :exists} if a pod with that name is already stored.
Delete a pod by name. Deleting a missing pod is a no-op :ok.
Fetch a single pod by name (authoritative read straight from Khepri).
List all stored pods via the ETS projection — a fast local read. Eventually consistent with writes (the reconciler is level-triggered, so that is fine).
Write (create or overwrite) the desired state of a pod.
Start the store seam. See the moduledoc for :store_id / :data_dir.
Functions
Supervisor child spec for the store seam.
@spec create_pod(Tank.Pod.t()) :: :ok | {:error, :exists | term()}
Write a pod only if it does not already exist (the create-if-absent seed
path). Returns {:error, :exists} if a pod with that name is already stored.
Delete a pod by name. Deleting a missing pod is a no-op :ok.
@spec get_pod(String.t()) :: {:ok, Tank.Pod.t()} | {:error, :not_found}
Fetch a single pod by name (authoritative read straight from Khepri).
@spec list_pods() :: [Tank.Pod.t()]
List all stored pods via the ETS projection — a fast local read. Eventually consistent with writes (the reconciler is level-triggered, so that is fine).
@spec put_pod(Tank.Pod.t()) :: :ok | {:error, term()}
Write (create or overwrite) the desired state of a pod.
@spec start_link(keyword()) :: GenServer.on_start()
Start the store seam. See the moduledoc for :store_id / :data_dir.