Mobius.EventLog (Mobius v0.8.0)

Copy Markdown View Source

API for working with the event log

Summary

Types

Options to query the event log

Options for serializing the event log

Functions

Clear the event log

Turn a list of Events into a binary

List the events in the event log

Parse the Mobius binary formatted event log

Save the current state of the event log to disk

Return the event log in the Mobius binary format

Types

opt()

@type opt() ::
  {:from, integer()}
  | {:to, integer()}
  | {:instance, Mobius.instance()}
  | {:group, atom()}

Options to query the event log

  • :from - the unix timestamp (in seconds) to start listing events from
  • :to - the unix timestamp (in seconds) to list events until
  • :instance - the Mobius instance to query (defaults to :mobius)
  • :group - only list events that belong to this event group

serialize_opt()

@type serialize_opt() :: {:compression_level, 0..9}

Options for serializing the event log

  • :compression_level - the zlib level (0..9) used to compress the payload, defaults to 9. 0 disables compression.

Functions

clear(opts \\ [])

@spec clear([opt()]) :: :ok

Clear the event log

Empties the in-memory event log and removes the persisted event log file for the instance.

events_to_binary(events, opts \\ [])

@spec events_to_binary([Mobius.Event.t()], [serialize_opt()]) :: binary()

Turn a list of Events into a binary

list(opts \\ [])

@spec list([opt()]) :: [Mobius.Event.t()]

List the events in the event log

parse(arg1)

@spec parse(binary()) :: {:ok, [Mobius.Event.t()]} | {:error, atom()}

Parse the Mobius binary formatted event log

save(opts \\ [])

@spec save([opt()]) :: :ok | {:error, reason :: term()}

Save the current state of the event log to disk

The configured compression level for the instance is applied by the events server when it writes the file.

to_binary(opts \\ [])

@spec to_binary([opt() | serialize_opt()]) :: binary()

Return the event log in the Mobius binary format