Wardrik.Channel.Installations behaviour (wardrik_protocol v0.1.0-rc.6)

Copy Markdown

A behaviour for storing the workspaces a channel is added to, each with its token.

  • A channel takes one as installations: {module, opts}.
  • Without it, a channel given token: serves only that token's workspace.
  • Tokens are secrets. Store them as you store your others.

Summary

Callbacks

Deletes the channel's installation in the request's workspace, if there is one.

Fetches the channel's installation in the request's workspace.

Returns the channel's installations whose owner is the request's.

Stores installation, replacing any with the same channel and workspace.

Callbacks

delete(t, opts)

@callback delete(Wardrik.Channel.Installations.Request.t(), opts :: term()) :: :ok

Deletes the channel's installation in the request's workspace, if there is one.

fetch(t, opts)

@callback fetch(Wardrik.Channel.Installations.Request.t(), opts :: term()) ::
  {:ok, Wardrik.Channel.Installation.t()} | :error

Fetches the channel's installation in the request's workspace.

owned(t, opts)

Returns the channel's installations whose owner is the request's.

put(t, opts)

@callback put(Wardrik.Channel.Installation.t(), opts :: term()) ::
  :ok | {:error, String.t()}

Stores installation, replacing any with the same channel and workspace.