-module(gm_ctflow_fun). -type flow() :: gm_ctflow:flow(). -type request() :: any(). -type result() :: any(). -type state() :: any(). -export([ new/3 %% (Flow, Fun, InitState) , call/2 %% (Flow, Req) , call/3 %% (Flow, Req, Timeout) , get_state/1 %% (Flow) , get_state/2 %% (Flow, Timeout) ]). -spec new(Flow, F, St) -> ok when Flow :: gm_ctflow:flow(), F :: fun((Req, St) -> {ok, Res, St}), Req :: request(), St :: state(), Res :: result(). new(Flow, F, St) -> gm_ctflow_server:new(Flow, F, St). -spec call(flow(), request()) -> result() | no_return(). call(Flow, Req) -> gm_ctflow_server:call(Flow, Req). -spec call(flow(), request(), timeout()) -> result() | no_return(). call(Flow, Req, Timeout) -> gm_ctflow_server:call(Flow, Req, Timeout). -spec get_state(flow()) -> state() | no_return(). get_state(Flow) -> gm_ctflow_server:get_state(Flow). -spec get_state(flow(), timeout()) -> state() | no_return(). get_state(Flow, Timeout) -> gm_ctflow_server:get_state(Flow, Timeout).