barrel_ngram_registry (barrel_ngram v0.7.1)

View Source

Local name registry for ngram shards.

Corpus and shard names are arbitrary terms ({shard, Corpus}), so a dynamically named shard never grows the atom table the way {local, Atom} registration would. Implements the {via, Module, Name} callbacks over a public ETS table; the owner monitors registered pids and clears dead entries so a crashed shard never leaves a stale registration behind.

Summary

Functions

Start the registry if it is not running. Covers callers that start shards without the barrel_ngram application (eunit, embedded use); under the application the supervisor owns it.

via callback: register Name to Pid. yes on success, no if the name is taken by a live process.

via callback.

via callback.

via callback: resolve Name to a live pid or undefined.

Functions

ensure()

-spec ensure() -> ok.

Start the registry if it is not running. Covers callers that start shards without the barrel_ngram application (eunit, embedded use); under the application the supervisor owns it.

handle_call(_, From, Mons)

handle_cast(Msg, Mons)

handle_info(Info, Mons)

init(_)

register_name(Name, Pid)

-spec register_name(term(), pid()) -> yes | no.

via callback: register Name to Pid. yes on success, no if the name is taken by a live process.

send(Name, Msg)

-spec send(term(), term()) -> pid().

via callback.

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

unregister_name(Name)

-spec unregister_name(term()) -> ok.

via callback.

whereis_name(Name)

-spec whereis_name(term()) -> pid() | undefined.

via callback: resolve Name to a live pid or undefined.