Spectre.Journal.Buffer (Spectre v0.3.0)

Copy Markdown View Source

Bounded asynchronous delivery queue for observational journal writes.

Deliveries are serialized within a partition and may run concurrently across partitions. Recorder partitions are keyed by store module, so a slow store cannot head-of-line block an unrelated store. The global queue and worker bound prevent failed stores from creating unbounded tasks.

Summary

Functions

Returns a specification to start this module under a supervisor.

Adds a zero-arity delivery function to the bounded queue.

Returns privacy-safe queue, delivery, drop, and latency counters.

Types

enqueue_option()

@type enqueue_option() ::
  {:buffer_size, pos_integer()}
  | {:overflow, :drop_newest | :drop_oldest}
  | {:partition, term()}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

enqueue(delivery, opts \\ [])

@spec enqueue((-> term()), [enqueue_option()]) ::
  :ok | {:ok, :dropped_oldest} | {:error, term()}

Adds a zero-arity delivery function to the bounded queue.

stats(server \\ __MODULE__)

@spec stats(GenServer.server()) :: map()

Returns privacy-safe queue, delivery, drop, and latency counters.