Amnesia.Event (nuamnesia v0.3.0)

This module implements helpers to handle mnesia events.

Summary

Functions

Observe the given events with the given function.

Report an event, see mnesia:report_event.

Subscribe to events of a given category, see mnesia:subscribe.

Unsubscribe from events of a given category, see mnesia:unsubscribe.

Types

activity()

@type activity() :: {:complete, Amnesia.Access.id()}

category()

@type category() :: system() | activity() | table()

system()

@type system() ::
  {:mnesia_up, node()}
  | {:mnesia_down, node()}
  | {:mnesia_checkpoint_activated, any()}
  | {:mnesia_overload, any()}
  | {:inconsistent_database, any()}
  | {:mnesia_fatal, charlist(), [any()], binary()}
  | {:mnesia_info, charlist(), [any()]}
  | {:mnesia_user, any()}

table()

@type table() ::
  {:write, tuple(), Amnesia.Access.id()}
  | {:delete_object, tuple(), Amnesia.Access.id()}
  | {:delete, {atom(), any()}, Amnesia.Access.id()}
  | {:write, atom(), tuple(), [tuple()], Amnesia.Access.id()}
  | {:delete, atom(), any(), [tuple()], Amnesia.Access.id()}

Functions

observe(categories, fun)

@spec observe(category() | [category()], (any() -> none())) :: pid()

Observe the given events with the given function.

report(event)

@spec report(any()) :: :ok

Report an event, see mnesia:report_event.

subscribe(category)

@spec subscribe(category()) :: none()

Subscribe to events of a given category, see mnesia:subscribe.

unsubscribe(category)

@spec unsubscribe(category()) :: none()

Unsubscribe from events of a given category, see mnesia:unsubscribe.