View Source edb_node_monitor (edb v0.3.0)

Summary

Types

call_request/0

-type call_request() ::
          {attach, node(), timeout()} |
          detach |
          {subscribe_to_events, pid()} |
          {remove_event_subscription, edb:event_subscription()}.

cast_request/0

-type cast_request() :: {try_attach, node()}.

start_opts/0

-type start_opts() :: [].

state/0

-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

attach(Node, AttachTimeout)

-spec attach(node(), timeout()) -> ok | {error, Reason}
                when Reason :: nodedown | edb:start_error() | term().

attached_node()

-spec attached_node() -> node().

detach()

-spec detach() -> ok.

handle_call(Request, From, State)

-spec handle_call(Request, From, state()) -> Result
                     when
                         Request :: call_request(),
                         From :: gen_server:from(),
                         Result ::
                             {reply, Reply :: term(), NewState :: state()} |
                             {noreply, NewState :: state()}.

handle_cast(Request, State0)

-spec handle_cast(Request, state()) -> Result
                     when Request :: cast_request(), Result :: {noreply, state()}.

handle_info(Info, 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()}.

init(_)

-spec init(start_opts()) -> {ok, state()}.

start()

-spec start() -> gen_server:start_ret().

subscribe()

-spec subscribe() -> {ok, edb:event_subscription()}.

terminate(Reason, State)

-spec terminate(Reason :: term(), State :: state()) -> ok.

unsubscribe(Subscription)

-spec unsubscribe(Subscription) -> ok when Subscription :: edb:event_subscription().