mirror of
https://github.com/valitydev/fistful-server.git
synced 2024-11-06 02:35:18 +00:00
Hardcode session namespace
This commit is contained in:
parent
c79e6e24f4
commit
afa14335c2
@ -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).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
Loading…
Reference in New Issue
Block a user