PhoenixReplay.Export.Queue behaviour (PhoenixReplay v0.6.2)

Copy Markdown View Source

Where video exports wait their turn and run.

PhoenixReplay.Export.Queue.Local, the default, keeps them in memory on the node that asked for them. PhoenixReplay.Export.Queue.Oban keeps them in your Oban queue, so they survive restarts and run on any node of a cluster. The :queue option of :export chooses one: a module, or {module, opts}.

Either way, every change to a job is broadcast with broadcast/1, so PhoenixReplay.Export.subscribe/1 follows jobs from either.

Summary

Types

t()

A queue module and its options.

Callbacks

Cancels the job with id, if it is queued or running. A running one is asked to stop, and ends :cancelled.

The job with id, if it is still kept.

The latest job for a recording, if one is kept.

Queues an export of a recording, unless one is queued or running, which is returned instead.

Functions

Tells subscribers of the job's recording that it changed. Nobody may be listening, and the export goes on either way.

The queue config exports through.

Subscribes the caller to the jobs of a recording; see broadcast/1.

Types

t()

@type t() :: {module(), keyword()}

A queue module and its options.

Callbacks

cancel(id, keyword)

@callback cancel(PhoenixReplay.Export.Job.id(), keyword()) :: :ok

Cancels the job with id, if it is queued or running. A running one is asked to stop, and ends :cancelled.

get(id, keyword)

The job with id, if it is still kept.

latest(id, keyword)

The latest job for a recording, if one is kept.

start(id, t, t, keyword)

Queues an export of a recording, unless one is queued or running, which is returned instead.

Functions

broadcast(job)

@spec broadcast(PhoenixReplay.Export.Job.t()) :: :ok

Tells subscribers of the job's recording that it changed. Nobody may be listening, and the export goes on either way.

of(config)

@spec of(PhoenixReplay.Config.t()) :: t()

The queue config exports through.

subscribe(recording_id)

@spec subscribe(PhoenixReplay.Recording.id()) :: :ok | {:error, term()}

Subscribes the caller to the jobs of a recording; see broadcast/1.