Membrane.HTTPAdaptiveStream.Storage behaviour (Membrane HTTP Adaptive Stream plugin v0.4.0) View Source

Behaviour for storing manifests and stream segments.

Link to this section Summary

Callbacks

Generates the storage state based on the configuration struct.

Stores the resource on a storage.

Functions

Stores a new segment and removes stale ones.

Removes all the saved segments and manifests.

Clears the manifest cache.

Initializes the storage.

Stores stream header file.

Stores serialized manifest files

Link to this section Types

Specs

callback_result_t() :: :ok | {:error, reason :: any()}

Specs

config_t() :: struct()

Specs

state_t() :: any()

Specs

t()

Link to this section Callbacks

Specs

init(config_t()) :: state_t()

Generates the storage state based on the configuration struct.

Link to this callback

remove(resource_name, context, state_t)

View Source

Specs

remove(
  resource_name :: String.t(),
  context :: %{type: :manifest | :header | :segment},
  state_t()
) :: callback_result_t()

Removes the resource.

Link to this callback

store(resource_name, content, context, state_t)

View Source

Specs

store(
  resource_name :: String.t(),
  content :: String.t() | binary(),
  context :: %{type: :manifest | :header | :segment, mode: :text | :binary},
  state_t()
) :: callback_result_t()

Stores the resource on a storage.

Gets the mode that should be used when writing to a file and type of the resource

Link to this section Functions

Link to this function

apply_segment_changeset(storage, arg, payload)

View Source

Specs

apply_segment_changeset(
  t(),
  {to_add :: String.t(), to_remove :: [String.t()]},
  payload :: binary()
) :: {callback_result_t(), t()}

Stores a new segment and removes stale ones.

Link to this function

cleanup(storage, segments)

View Source

Specs

cleanup(t(), segments :: [String.t()]) :: {callback_result_t(), t()}

Removes all the saved segments and manifests.

Specs

clear_cache(t()) :: t()

Clears the manifest cache.

Link to this function

new(storage_config, opts \\ [])

View Source

Specs

new(config_t(), [{:enable_cache, boolean()}]) :: t()

Initializes the storage.

Accepts the following options:

  • enable_cache - if true (default), manifests will be stored only if they've been changed
Link to this function

store_header(storage, name, payload)

View Source

Specs

store_header(t(), name :: String.t(), payload :: binary()) ::
  {callback_result_t(), t()}

Stores stream header file.

Link to this function

store_manifests(storage, manifests)

View Source

Specs

store_manifests(t(), [{name :: String.t(), content :: String.t()}]) ::
  {callback_result_t(), t()}

Stores serialized manifest files