MPP.Session.ETSStore (mpp v0.15.0)

Copy Markdown View Source

ETS-backed default implementation of MPP.Session.Store.

A GenServer owns the ETS table and serializes read-modify-write callbacks, making update/2 atomic within one BEAM node. Use a shared custom backend for channel state that must be consistent across multiple nodes.

Summary

Functions

Return a child specification for an ETS session store.

Delete channel state from the default store.

Delete channel state from a configured store instance.

Look up a channel in the default store.

Look up a channel in a configured store instance.

Insert or replace channel state in the default store.

Insert or replace channel state in a configured store instance.

Start an ETS session store.

Atomically update channel state in the default store.

Atomically update channel state in a configured store instance.

Functions

child_spec(init_arg)

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

Return a child specification for an ETS session store.

delete(channel_id)

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

Delete channel state from the default store.

delete(channel_id, opts)

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

Delete channel state from a configured store instance.

get(channel_id)

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

Look up a channel in the default store.

get(channel_id, opts)

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

Look up a channel in a configured store instance.

put(channel)

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

Insert or replace channel state in the default store.

put(channel, opts)

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

Insert or replace channel state in a configured store instance.

start_link(opts \\ [])

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

Start an ETS session store.

update(channel_id, fun)

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

Atomically update channel state in the default store.

update(channel_id, fun, opts)

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

Atomically update channel state in a configured store instance.