View Source locus_database (locus v2.3.7)

Launches locus_database_loader and later shares the unpacked database, as well as any updates to it, through persistent_term.

Link to this section Summary

Link to this section Types

Specs

database_opt() :: {event_subscriber, atom() | pid()}.

Specs

Link to this type

event_load_attempt_finished/0

View Source

Specs

event_load_attempt_finished() ::
    {load_attempt_finished, locus_loader:source(), {ok, Version :: calendar:datetime()}} |
    {load_attempt_finished, locus_loader:source(), {error, term()}}.

Specs

monitor() :: reference().

Specs

opt() :: database_opt() | locus_loader:opt().

Specs

origin() :: locus_loader:origin().

Specs

state() :: #state{}.

Specs

static_child_spec() ::
    #{id := term(),
      start := {locus_database, start_link, [atom() | origin() | [opt()], ...]},
      restart := permanent,
      shutdown := non_neg_integer(),
      type := worker,
      modules := [locus_database, ...]}.

Link to this section Functions

Link to this function

async_get_version_or_subscribe(Id)

View Source

Specs

async_get_version_or_subscribe(atom()) -> {await, reference()}.
Link to this function

code_change(OldVsn, State, Extra)

View Source

Specs

code_change(term(), state(), term()) -> {ok, state()}.
Link to this function

dynamic_child_spec(ChildId)

View Source

Specs

dynamic_child_spec(term()) -> supervisor:child_spec().

Specs

find(atom()) ->
        {ok, locus_mmdb:database(), locus_loader:source(), calendar:datetime()} |
        {error, database_not_loaded} |
        {error, database_unknown}.
Link to this function

handle_call(Call, From, State)

View Source

Specs

handle_call(term(), {pid(), reference()}, state()) -> {stop, unexpected_call, state()}.
Link to this function

handle_cast(Cast, State)

View Source

Specs

handle_cast(term(), state()) -> {noreply, state()} | {stop, unexpected_cast, state()}.
Link to this function

handle_info(Info, State)

View Source

Specs

handle_info(term(), state()) -> {noreply, state()} | {stop, term(), state()}.

Specs

init([atom() | origin() | [opt()], ...]) -> {ok, state()} | {stop, {invalid_opt, term()}}.

Specs

start(atom(), origin(), [opt()]) ->
         ok |
         {error, already_started} |
         {error, {invalid_opt, term()}} |
         {error, application_not_running}.
Link to this function

start_link(Id, Origin, Opts)

View Source

Specs

start_link(atom(), origin(), [opt()]) -> {ok, pid()}.
Link to this function

static_child_spec(ChildId, DatabaseId, Origin, Opts)

View Source

Specs

static_child_spec(term(), atom(), origin(), [opt()]) -> static_child_spec().

Specs

stop(atom(), term()) -> ok | {error, not_found}.
Link to this function

terminate(Reason, State)

View Source

Specs

terminate(term(), state()) -> ok.

Specs

version(BuildEpoch) -> Version
           when BuildEpoch :: non_neg_integer(), Version :: calendar:datetime().
Returns the database version based on its build epoch (UNIX timestamp)