View Source erldns_storage (erldns v4.2.0)

API for a module's function calls. Please note that all crashes should be handled at the lowest level of the API (ex. erldns_storage_json).

Summary

Functions

Backup the table to the JSON file. https://github.com/SiftLogic/erl-dns/issues/3

Backup the tables to the JSON file. https://github.com/SiftLogic/erl-dns/issues/3

Call to a module's create. Creates a new table.

Call to a module's delete. Deletes a key value from a table.

Call to a module's delete_table. Deletes the entire table.

This function emptys the specified table of all values.

Call to a module's foldl.

Backups the tables in the given period

Inits the module, and sends a "timeout" to handle_info to start the poller for table backup

Call to a module's insert. Inserts a value into the table.

List all elements in a table.

Load zones from a file. The default file name is "zones.json".(copied from erldns_zone_loader.erl)

Load zones from a file. The default file name is "zones.json".(copied from erldns_zone_loader.erl)

Call to a module's select. Uses table key pair, and can be considered a "lookup" in terms of ets.

Call to a module's select/3 Uses a matchspec to generate matches.

Functions

backup_table(Table)

-spec backup_table(atom()) -> ok | {error, Reason :: term()}.

Backup the table to the JSON file. https://github.com/SiftLogic/erl-dns/issues/3

backup_tables()

-spec backup_tables() -> ok | {error, Reason :: term()}.

Backup the tables to the JSON file. https://github.com/SiftLogic/erl-dns/issues/3

code_change(OldVsn, State, Extra)

create(Table)

-spec create(atom()) -> ok | {error, Reason :: term()}.

Call to a module's create. Creates a new table.

delete(Table, Key)

-spec delete(atom(), term()) -> ok | {error, Reason :: term()}.

Call to a module's delete. Deletes a key value from a table.

delete_table(Table)

-spec delete_table(atom()) -> ok | {error, Reason :: term()}.

Call to a module's delete_table. Deletes the entire table.

empty_table(Table)

-spec empty_table(atom()) -> ok | {error, Reason :: term()}.

This function emptys the specified table of all values.

foldl(Fun, Acc, Table)

-spec foldl(fun(), list(), atom()) -> Acc :: term() | {error, Reason :: term()}.

Call to a module's foldl.

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

Backups the tables in the given period

init(_)

Inits the module, and sends a "timeout" to handle_info to start the poller for table backup

insert(Table, Value)

-spec insert(atom(), tuple()) -> ok | {error, Reason :: term()}.

Call to a module's insert. Inserts a value into the table.

list_table(TableName)

-spec list_table(atom()) -> [] | term() | {error, term()}.

List all elements in a table.

load_zones()

-spec load_zones() -> {ok, integer()} | {err, atom()}.

Load zones from a file. The default file name is "zones.json".(copied from erldns_zone_loader.erl)

load_zones(Filename)

-spec load_zones(list()) -> {ok, integer()} | {err, atom()}.

Load zones from a file. The default file name is "zones.json".(copied from erldns_zone_loader.erl)

select(Table, Key)

-spec select(atom(), term()) -> [tuple()].

Call to a module's select. Uses table key pair, and can be considered a "lookup" in terms of ets.

select(Table, MatchSpec, Limit)

-spec select(atom(), list(), infinite | integer()) -> [tuple()].

Call to a module's select/3 Uses a matchspec to generate matches.

select_delete(Table, MatchSpec)

-spec select_delete(atom(), list()) -> {ok, Count :: integer()} | {error, Reason :: term()}.

start_link()

terminate(Reason, State)