Behaviours: gen_server, watts_persistent.
state() = #state{con = undefined | esqlite:connection()}
code_change/3 | do nothing, just return the old state. |
create_random_uuid/1* | generate a random unique uuid. |
create_tables_if_needed/1* | create the needed tables in the database, if needed. |
credential_add/5 | store a credential for a user A callback from the watts_persistent behaviour. |
credential_add/6* | add a credential into the databas, this is the SQL implementation. |
credential_get/1 | get a specific credential. |
credential_get/2* | return a specific credential. |
credential_get_count/2 | get the number of credentials for a user at a service. |
credential_get_count/3* | return the number of credential the user has at the service. |
credential_get_list/1 | get the list of credentials for a user A callback from the watts_persistent behaviour. |
credential_get_list/2* | return the list of credentials for a given user. |
credential_remove/2 | remove a credential of a user A callback from the watts_persistent behaviour. |
credential_remove/3* | delete the credential of the user. |
credential_state_unique/4* | check if the state is unique for the user at the service. |
handle_call/3 | call handling for the gen server. |
handle_cast/2 | implement the cast handling. |
handle_info/2 | all other messages are ignored. |
init/1 | intialize the state of the gen_server. |
initialize/0 | initialize the sqlite database. |
is_ready/0 | return if the database is ready. |
reconfigure/0 | trigger reconfiguration of the sqlite connection. |
reconfigure/2* | (re)start the connection to the database file. |
start_link/0 | start the gen_server process. |
stop/0 | stop the sqlite gen_server process. |
terminate/2 | close sqlite database handle on termination, if needed. |
do nothing, just return the old state.
create_random_uuid(Connection::esqlite:connection()) -> binary()
generate a random unique uuid.
create_tables_if_needed(Connection::esqlite:connection()) -> ok
create the needed tables in the database, if needed
credential_add(UserId::binary(), ServiceId::binary(), Interface::binary(), CredState::any(), AllowNonUniqueStates::boolean()) -> {ok, CredentialID::binary()} | {error, Reason::atom()}
store a credential for a user A callback from the watts_persistent behaviour.
credential_add(UserId::binary(), ServiceId::binary(), Interface::binary(), CredState::any(), SameStateOk::boolean(), Connect::esqlite:connection()) -> {ok, CredId::binary()} | {error, Reason::atom()}
add a credential into the databas, this is the SQL implementation.
credential_get(CredId::binary()) -> {ok, watts:credential()} | {error, Reason::atom()}
get a specific credential. A callback from the watts_persistent behaviour.
credential_get(CredentialId::binary(), Con::esqlite:connection()) -> {ok, watts:credential()} | {error, Reason::atom()}
return a specific credential
credential_get_count(UserId::binary(), ServiceId::binary()) -> {ok, pos_integer()}
get the number of credentials for a user at a service. A callback from the watts_persistent behaviour.
credential_get_count(UserId::binary(), ServiceId::binary, Con::esqlite:connection()) -> pos_integer()
return the number of credential the user has at the service.
credential_get_list(UserId::binary()) -> {ok, [watts:credential()]}
get the list of credentials for a user A callback from the watts_persistent behaviour.
credential_get_list(UserId::binary(), Con::esqlite:connection()) -> [watts:credential()]
return the list of credentials for a given user
credential_remove(UserId::binary(), CredentialId::binary()) -> ok | {error, Reason::atom()}
remove a credential of a user A callback from the watts_persistent behaviour.
credential_remove(UserId::binary(), CredentialId::binary(), Con::esqlite:connection()) -> ok
delete the credential of the user.
credential_state_unique(UserId::binary(), ServiceId::binary(), CredState::any(), Con::esqlite:connection()) -> {true, none} | {false, CredId::binary()}
check if the state is unique for the user at the service.
call handling for the gen server. This function serializes the api calls and performs one after the other.
implement the cast handling. Supports only 'reconfigure' and 'stop'.
all other messages are ignored
init(X1::noparams) -> {ok, state()}
intialize the state of the gen_server.
initialize() -> ok
initialize the sqlite database. A callback from the watts_persistent behaviour.
is_ready() -> true | {false, Reason::atom()}
return if the database is ready. A callback from the watts_persistent behaviour.
reconfigure() -> ok
trigger reconfiguration of the sqlite connection
(re)start the connection to the database file.
start_link() -> {ok, pid()}
start the gen_server process
stop() -> ok
stop the sqlite gen_server process
terminate(Reason::any(), State::state()) -> ok
close sqlite database handle on termination, if needed.
Generated by EDoc