View Source edb_node_monitor (edb v0.3.0)
Summary
Types
-type call_request() :: {attach, node(), timeout()} | detach | {subscribe_to_events, pid()} | {remove_event_subscription, edb:event_subscription()}.
-type cast_request() :: {try_attach, node()}.
-type start_opts() :: [].
-type state() :: #{attached_node := not_attached | {attaching, node(), Caller :: gen_server:from(), TimerRef :: undefined | reference()} | {up, node()} | {down, node()}, event_subscribers := edb_events:subscribers()}.
Functions
-spec attach(node(), timeout()) -> ok | {error, Reason} when Reason :: nodedown | edb:start_error() | term().
-spec attached_node() -> node().
-spec detach() -> ok.
-spec handle_call(Request, From, state()) -> Result when Request :: call_request(), From :: gen_server:from(), Result :: {reply, Reply :: term(), NewState :: state()} | {noreply, NewState :: state()}.
-spec handle_cast(Request, state()) -> Result when Request :: cast_request(), Result :: {noreply, state()}.
-spec handle_info(Info, State :: state()) -> {noreply, state()} when Info :: {nodedown, node(), #{node_type := hidden | visible, nodedown_reason := term()}} | {nodeup, node(), #{node_type := hidden | visible}} | {timeout, TimeRef :: reference(), attaching} | {'DOWN', MonitorRef :: reference(), process, pid(), Info :: term()}.
-spec init(start_opts()) -> {ok, state()}.
-spec start() -> gen_server:start_ret().
-spec subscribe() -> {ok, edb:event_subscription()}.
-spec unsubscribe(Subscription) -> ok when Subscription :: edb:event_subscription().