Behaviour for persistent recording storage backends.
Active (in-flight) recordings always live in ETS for performance. When a LiveView process exits, the recording is finalized and persisted through the configured storage backend.
Built-in backends
PhoenixReplay.Storage.File— writes recordings to disk (default)PhoenixReplay.Storage.Ecto— stores recordings in a database via Ecto
Configuration
config :phoenix_replay,
storage: PhoenixReplay.Storage.File,
storage_opts: [
path: "priv/replay_recordings",
format: :etf # or :json
]Serialization formats
:etf— Erlang External Term Format (:erlang.term_to_binary/1). Fast, compact, preserves all Elixir types. Default.:json— JSON viaJason. Portable, human-readable, but lossy for atoms, tuples, and structs.
Summary
Callbacks
Delete all recordings.
Delete a recording by ID.
Retrieve a recording by ID.
Initialize the backend (create tables, directories, etc).
List all recordings, most recent first.
List lightweight recording summaries, most recent first.
Persist a finalized recording.
Types
@type opts() :: keyword()
Callbacks
@callback clear(opts()) :: :ok
Delete all recordings.
Delete a recording by ID.
@callback get(binary(), opts()) :: {:ok, PhoenixReplay.Recording.t()} | :error
Retrieve a recording by ID.
Initialize the backend (create tables, directories, etc).
@callback list(opts()) :: [PhoenixReplay.Recording.t()]
List all recordings, most recent first.
List lightweight recording summaries, most recent first.
@callback save(PhoenixReplay.Recording.t(), opts()) :: :ok | {:error, term()}
Persist a finalized recording.