Module watts_ets

This module implements storage and lookup of data in ETS tables.

Behaviours: gen_server.

Description

This module implements storage and lookup of data in ETS tables. Including a minimal gen_server to stay owner of the ets tables.

Function Index

code_change/3just return back the state 'nothing'.
create_lookup_result/1*convert the lookup result into ok/error tuple.
create_table/1*create a single ets table with name TableName.
create_tables/0*create the ets tables.
delete/2*delete the specified Entry.
delete_table/1*delete a single table.
delete_tables/0*delete all tables.
destroy/0delete all ets tables.
get_all_entries/1*get all entries of a table.
handle_call/3create or delete tables.
handle_cast/2handles stop and does ignore everything else.
handle_info/2does ignore everything.
init/0create the ets tables.
init/1no initilization needed.
insert/2*insert an entry into the table.
insert_new/2*insert an new entry into the table.
lookup/2*lookup a key in the given table.
return_ok_or_error/1*convert booelan to ok/{error, reason}.
return_value/1*unify return value.
service_add/2add a service with the given Identifier and its Config.
service_get/1lookup a service by its id.
service_get_list/0get a list of all service configs.
service_update/2update the Config of the given ServiceId.
sessions_create_new/1create a new session entry, without a pid.
sessions_delete/1delete the session entry for the given token.
sessions_get_list/0get the list of all sessions.
sessions_get_pid/1return the pid for a given token or error.
sessions_update_pid/2update the pid for the given token.
start_link/0start the minimal gen_server linked.
stop/0trigger a stop of the gen_server.
terminate/2log on termination due to error.
wait_for_tables/1*wait until the tables are ready.

Function Details

code_change/3

code_change(X1::any(), State::nothing, X3::any()) -> {ok, nothing}

just return back the state 'nothing'

create_lookup_result/1 *

create_lookup_result(X1::[any()]) -> {ok, any()} | {error, not_found}

convert the lookup result into ok/error tuple

create_table/1 *

create_table(Name::atom()) -> ets:tid() | atom()

create a single ets table with name TableName

create_tables/0 *

create_tables() -> ok

create the ets tables

delete/2 *

delete(Table::atom(), Key::any()) -> ok

delete the specified Entry.

delete_table/1 *

delete_table(Name::atom()) -> ok

delete a single table

delete_tables/0 *

delete_tables() -> ok

delete all tables

destroy/0

destroy() -> ok

delete all ets tables

get_all_entries/1 *

get_all_entries(Table::atom()) -> [any()]

get all entries of a table

handle_call/3

handle_call(X1::any(), From::any(), State::nothing) -> {reply, ok, nothing} | {reply, ignored, nothing}

create or delete tables

handle_cast/2

handle_cast(X1::any(), State::nothing) -> {stop, normal, noting} | {noreply, nothing}

handles stop and does ignore everything else

handle_info/2

handle_info(X1::any(), State::nothing) -> {noreply, nothing}

does ignore everything

init/0

init() -> ok

create the ets tables

init/1

init(X1::noparams) -> {ok, nothing}

no initilization needed

insert/2 *

insert(Table::atom(), Entry::any()) -> true

insert an entry into the table

insert_new/2 *

insert_new(Table::atom(), Entry::any()) -> boolean()

insert an new entry into the table

lookup/2 *

lookup(Table::atom(), Key::any()) -> {ok, Element::any()} | {error, not_found}

lookup a key in the given table

return_ok_or_error/1 *

return_ok_or_error(X1::boolean()) -> ok | {error, already_exists}

convert booelan to ok/{error, reason}

return_value/1 *

return_value(Error::{ok, {Key::any(), Value::any()}} | {error, any()}) -> {ok, Value::any()} | {error, any()}

unify return value

service_add/2

service_add(Identifier::binary(), Info::map()) -> ok | {error, Reason::atom()}

add a service with the given Identifier and its Config

service_get/1

service_get(Identifier::binary()) -> {ok, tuple()} | {error, Reason::atom()}

lookup a service by its id

service_get_list/0

service_get_list() -> {ok, [map()]}

get a list of all service configs

service_update/2

service_update(Identifier::binary(), Info::map()) -> ok | {error, Reason::atom()}

update the Config of the given ServiceId.

sessions_create_new/1

sessions_create_new(Token::binary()) -> ok | {error, Reason::atom()}

create a new session entry, without a pid.

sessions_delete/1

sessions_delete(Token::binary()) -> ok

delete the session entry for the given token

sessions_get_list/0

sessions_get_list() -> [map()]

get the list of all sessions

sessions_get_pid/1

sessions_get_pid(Token::binary()) -> {ok, Pid::pid()} | {error, Reason::atom()}

return the pid for a given token or error

sessions_update_pid/2

sessions_update_pid(Token::binary(), Pid::pid()) -> ok

update the pid for the given token

start_link/0

start_link() -> {ok, pid()}

start the minimal gen_server linked

stop/0

stop() -> ok

trigger a stop of the gen_server

terminate/2

terminate(Reason::any(), X2::nothing) -> ok

log on termination due to error

wait_for_tables/1 *

wait_for_tables(List::[atom()]) -> ok

wait until the tables are ready


Generated by EDoc