Behaviour and dispatch helpers for recurring-subscription persistence.
Updates must be atomic so concurrent renewal attempts cannot charge the same
billing period twice. MPP.Subscription.ETSStore is the single-node default.
Summary
Functions
Return the application-started subscription store.
Delete a subscription through a store reference.
Look up a subscription through a store reference.
Persist a subscription through a store reference.
Atomically update a subscription through a store reference.
Types
@type update_fun() :: (MPP.Subscription.Record.t() | :not_found -> {:ok, MPP.Subscription.Record.t()} | {:error, term()})
Callbacks
@callback get(String.t()) :: {:ok, MPP.Subscription.Record.t()} | :not_found | {:error, term()}
@callback put(MPP.Subscription.Record.t()) :: :ok | {:error, term()}
@callback update(String.t(), update_fun()) :: {:ok, MPP.Subscription.Record.t()} | {:error, term()}
Functions
@spec default_store() :: module()
Return the application-started subscription store.
Delete a subscription through a store reference.
@spec get(store_ref(), String.t()) :: {:ok, MPP.Subscription.Record.t()} | :not_found | {:error, term()}
Look up a subscription through a store reference.
@spec put(store_ref(), MPP.Subscription.Record.t()) :: :ok | {:error, term()}
Persist a subscription through a store reference.
@spec update(store_ref(), String.t(), update_fun()) :: {:ok, MPP.Subscription.Record.t()} | {:error, term()}
Atomically update a subscription through a store reference.