MPP.Subscription.ETSStore (mpp v0.15.0)

Copy Markdown View Source

Single-node atomic ETS store for recurring subscriptions.

Use a shared durable backend implementing MPP.Subscription.Store when subscriptions must survive node restarts or coordinate across nodes.

Summary

Functions

Return a child specification for a subscription store.

Delete a subscription from the default store.

Delete a subscription from a configured store instance.

Look up a subscription in the default store.

Look up a subscription in a configured store instance.

Insert or replace a subscription in the default store.

Insert or replace a subscription in a configured store instance.

Start an ETS subscription store.

Atomically update a subscription in the default store.

Atomically update a subscription in a configured store instance.

Functions

child_spec(opts \\ [])

@spec child_spec(keyword()) :: Supervisor.child_spec()

Return a child specification for a subscription store.

delete(id)

@spec delete(String.t()) :: :ok | {:error, term()}

Delete a subscription from the default store.

delete(id, opts)

@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, term()}

Delete a subscription from a configured store instance.

get(id)

@spec get(String.t()) ::
  {:ok, MPP.Subscription.Record.t()} | :not_found | {:error, term()}

Look up a subscription in the default store.

get(id, opts)

@spec get(
  String.t(),
  keyword()
) :: {:ok, MPP.Subscription.Record.t()} | :not_found | {:error, term()}

Look up a subscription in a configured store instance.

put(record)

@spec put(MPP.Subscription.Record.t()) :: :ok | {:error, term()}

Insert or replace a subscription in the default store.

put(record, opts)

@spec put(
  MPP.Subscription.Record.t(),
  keyword()
) :: :ok | {:error, term()}

Insert or replace a subscription in a configured store instance.

start_link(opts \\ [])

@spec start_link(keyword()) :: Agent.on_start()

Start an ETS subscription store.

update(id, fun)

@spec update(String.t(), MPP.Subscription.Store.update_fun()) ::
  {:ok, MPP.Subscription.Record.t()} | {:error, term()}

Atomically update a subscription in the default store.

update(id, fun, opts)

@spec update(String.t(), MPP.Subscription.Store.update_fun(), keyword()) ::
  {:ok, MPP.Subscription.Record.t()} | {:error, term()}

Atomically update a subscription in a configured store instance.