Tweaked the type specs.
This commit is contained in:
parent
ca89c4001a
commit
d6cc338707
|
@ -41,8 +41,9 @@
|
||||||
-type db_error_reason() :: atom() | {unknown, integer()}.
|
-type db_error_reason() :: atom() | {unknown, integer()}.
|
||||||
-type db_error() :: {error, db_error_reason()}.
|
-type db_error() :: {error, db_error_reason()}.
|
||||||
|
|
||||||
-type txn_fun() :: fun(() -> term()).
|
-type db_txn_fun() :: fun(() -> term()).
|
||||||
-type txn_retries() :: infinity | non_neg_integer().
|
-type db_txn_retries() :: infinity | non_neg_integer().
|
||||||
|
-type db_txn_error() :: {error, db_error_reason() | {transaction_failed, _}}.
|
||||||
|
|
||||||
-type db_update_fun() :: fun((db_key(), db_value(), any()) -> db_value()).
|
-type db_update_fun() :: fun((db_key(), db_value(), any()) -> db_value()).
|
||||||
-type db_update_fun_args() :: undefined | [term()].
|
-type db_update_fun_args() :: undefined | [term()].
|
||||||
|
@ -452,7 +453,7 @@ txn_abort() ->
|
||||||
%% @see transaction/3
|
%% @see transaction/3
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec transaction(Fun :: txn_fun()) -> {ok, db_value()} | db_error().
|
-spec transaction(Fun :: db_txn_fun()) -> {ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
transaction(Fun) ->
|
transaction(Fun) ->
|
||||||
transaction(Fun, infinity).
|
transaction(Fun, infinity).
|
||||||
|
@ -471,8 +472,8 @@ transaction(Fun) ->
|
||||||
%% @see transaction/3
|
%% @see transaction/3
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec transaction(Fun :: txn_fun(), Retries :: txn_retries()) ->
|
-spec transaction(Fun :: db_txn_fun(), Retries :: db_txn_retries()) ->
|
||||||
{ok, db_value()} | {error, db_error_reason() | {transaction_failed, term()}}.
|
{ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
transaction(Fun, Retries) ->
|
transaction(Fun, Retries) ->
|
||||||
transaction(Fun, Retries, []).
|
transaction(Fun, Retries, []).
|
||||||
|
@ -502,8 +503,8 @@ transaction(Fun, Retries) ->
|
||||||
%%
|
%%
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec transaction(Fun :: txn_fun(), Retries :: txn_retries(), Opts :: db_flags()) ->
|
-spec transaction(Fun :: db_txn_fun(), Retries :: db_txn_retries(), Opts :: db_flags()) ->
|
||||||
{ok, db_value()} | {error, db_error_reason() | {transaction_failed, term()}}.
|
{ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
transaction(_Fun, 0, _Opts) ->
|
transaction(_Fun, 0, _Opts) ->
|
||||||
ok = txn_abort(),
|
ok = txn_abort(),
|
||||||
|
@ -906,7 +907,7 @@ get_r(Db, Key, Opts) ->
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun()) ->
|
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun()) ->
|
||||||
{ok, db_value()} | db_error().
|
{ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
update(Db, Key, Fun) ->
|
update(Db, Key, Fun) ->
|
||||||
update(Db, Key, Fun, undefined, []).
|
update(Db, Key, Fun, undefined, []).
|
||||||
|
@ -928,7 +929,7 @@ update(Db, Key, Fun) ->
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args()) ->
|
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args()) ->
|
||||||
{ok, db_value()} | db_error().
|
{ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
update(Db, Key, Fun, Args) ->
|
update(Db, Key, Fun, Args) ->
|
||||||
update(Db, Key, Fun, Args, []).
|
update(Db, Key, Fun, Args, []).
|
||||||
|
@ -956,8 +957,8 @@ update(Db, Key, Fun, Args) ->
|
||||||
%%
|
%%
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), Opts :: db_flags) ->
|
-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), Opts :: db_flags()) ->
|
||||||
{ok, db_value()} | db_error().
|
{ok, db_value()} | db_txn_error().
|
||||||
|
|
||||||
update(Db, Key, Fun, Args, Opts) ->
|
update(Db, Key, Fun, Args, Opts) ->
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
|
@ -1200,7 +1201,7 @@ delete_database(Filename) ->
|
||||||
%%
|
%%
|
||||||
%% @end
|
%% @end
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
-spec get_data_dirs() -> [db_name(),...] | db_error().
|
-spec get_data_dirs() -> [string()] | db_error().
|
||||||
|
|
||||||
get_data_dirs() ->
|
get_data_dirs() ->
|
||||||
% Call into the BDB library and get a list of configured data directories
|
% Call into the BDB library and get a list of configured data directories
|
||||||
|
|
Loading…
Reference in a new issue