cellium_event_manager (cellium v0.1.0)

View Source

Event manager for handling terminal and external events.

Summary

Functions

Convert process state when code is changed.

Handling call messages.

Handling cast messages.

Handling all non call/cast messages.

Initializes the server.

Starts the server.

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

Functions

code_change(OldVsn, State, Extra)

-spec code_change(OldVsn :: term() | {down, term()}, State :: term(), Extra :: term()) ->
                     {ok, NewState :: term()} | {error, Reason :: term()}.

Convert process state when code is changed.

handle_call(Request, From, State)

-spec handle_call(Request :: term(), From :: {pid(), term()}, State :: term()) ->
                     {reply, Reply :: term(), NewState :: term()} |
                     {reply, Reply :: term(), NewState :: term(), Timeout :: timeout()} |
                     {reply, Reply :: term(), NewState :: term(), hibernate} |
                     {noreply, NewState :: term()} |
                     {noreply, NewState :: term(), Timeout :: timeout()} |
                     {noreply, NewState :: term(), hibernate} |
                     {stop, Reason :: term(), Reply :: term(), NewState :: term()} |
                     {stop, Reason :: term(), NewState :: term()}.

Handling call messages.

handle_cast(Request, State)

-spec handle_cast(Request :: term(), State :: term()) ->
                     {noreply, NewState :: term()} |
                     {noreply, NewState :: term(), Timeout :: timeout()} |
                     {noreply, NewState :: term(), hibernate} |
                     {stop, Reason :: term(), NewState :: term()}.

Handling cast messages.

handle_info(Info, State)

-spec handle_info(Info :: timeout() | term(), State :: term()) ->
                     {noreply, NewState :: term()} |
                     {noreply, NewState :: term(), Timeout :: timeout()} |
                     {noreply, NewState :: term(), hibernate} |
                     {stop, Reason :: normal | term(), NewState :: term()}.

Handling all non call/cast messages.

init(Args)

-spec init(Args :: term()) ->
              {ok, State :: term()} |
              {ok, State :: term(), Timeout :: timeout()} |
              {ok, State :: term(), hibernate} |
              {stop, Reason :: term()} |
              ignore.

Initializes the server.

send_event(Event)

start_link()

-spec start_link() ->
                    {ok, Pid :: pid()} |
                    {error, Error :: {already_started, pid()}} |
                    {error, Error :: term()} |
                    ignore.

Starts the server.

start_link(CallBackModule)

terminate(Reason, State)

-spec terminate(Reason :: normal | shutdown | {shutdown, term()} | term(), State :: term()) -> any().

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.