Hardcode session namespace

This commit is contained in:
Andrey Fadeev 2018-06-14 21:43:04 +03:00
parent c79e6e24f4
commit afa14335c2

View File

@ -4,9 +4,11 @@
-module(ff_adpt_session_machine). -module(ff_adpt_session_machine).
-behaviour(machinery). -behaviour(machinery).
-define(NS, adpt_session).
%% API %% API
-export([create/5]). -export([create/4]).
-export([get/3]). -export([get/2]).
%% machinery %% machinery
-export([init/4]). -export([init/4]).
@ -68,24 +70,23 @@
%% API %% API
%% %%
-spec create(Ns, Id, Adapter, Withdrawal, Be) -> {ok, session()} | Error when -spec create(Id, Adapter, Withdrawal, Be) -> {ok, session()} | Error when
Ns :: namespace(),
Id :: id(), Id :: id(),
Adapter :: adapter(), Adapter :: adapter(),
Withdrawal :: withdrawal(), Withdrawal :: withdrawal(),
Be :: backend(), Be :: backend(),
Error :: {error, exists}. Error :: {error, exists}.
create(Ns, Id, Adapter, Withdrawal, Be) -> create(Id, Adapter, Withdrawal, Be) ->
Session = create_session(Id, Adapter, Withdrawal), Session = create_session(Id, Adapter, Withdrawal),
do(fun () -> do(fun () ->
ok = unwrap(machinery:start(Ns, Id, Session, Be)), ok = unwrap(machinery:start(?NS, Id, Session, Be)),
unwrap(get(Ns, Id, Be)) unwrap(get(Id, Be))
end). end).
-spec get(namespace(), id(), backend()) -> {ok, session()} | {error, any()}. -spec get(id(), backend()) -> {ok, session()} | {error, any()}.
get(Ns, Id, Be) -> get(Id, Be) ->
do(fun () -> do(fun () ->
session(collapse(unwrap(machinery:get(Ns, Id, Be)))) session(collapse(unwrap(machinery:get(?NS, Id, Be))))
end). end).
%% %%