View Source ow_zone behaviour (overworld v2.0.0)

Summary

Types

-type from() :: gen_server:from().
-type server_name() :: gen_server:server_name().
-type server_ref() :: gen_server:server_ref().
-type session_pid() :: pid().
-type start_mon_ret() :: {ok, {pid(), reference()}} | ignore | {error, term()}.
-type start_opt() :: gen_server:start_opt().
-type start_ret() :: {ok, pid()} | ignore | {error, term()}.

Callbacks

Link to this callback

handle_disconnect/3

View Source (optional)
-callback handle_disconnect(From, ZoneData, State) -> Result
                               when
                                   From :: session_pid(),
                                   ZoneData :: zone_data(),
                                   State :: term(),
                                   Result :: ow_zone_cast_resp().
Link to this callback

handle_info/2

View Source (optional)
-callback handle_info(Msg, State) -> Result
                         when Msg :: term(), State :: term(), Result :: ow_zone_cast_resp().
Link to this callback

handle_join/4

View Source (optional)
-callback handle_join(Msg, From, ZoneData, State) -> Result
                         when
                             From :: session_pid(),
                             Msg :: term(),
                             ZoneData :: zone_data(),
                             State :: term(),
                             Result :: ow_zone_call_resp().
Link to this callback

handle_part/4

View Source (optional)
-callback handle_part(Msg, From, ZoneData, State) -> Result
                         when
                             From :: session_pid(),
                             Msg :: term(),
                             ZoneData :: zone_data(),
                             State :: term(),
                             Result :: ow_zone_call_resp().
Link to this callback

handle_reconnect/3

View Source (optional)
-callback handle_reconnect(From, ZoneData, State) -> Result
                              when
                                  From :: session_pid(),
                                  ZoneData :: zone_data(),
                                  State :: term(),
                                  Result :: ow_zone_call_resp().
-callback handle_tick(ZoneData, State) -> Result
                         when ZoneData :: zone_data(), State :: term(), Result :: ow_zone_cast_resp().
-callback init(Args) -> Result
                  when
                      Args :: term(),
                      Result :: {ok, InitialData} | {ok, InitialData, ConfigMap} | ignore | {stop, Reason},
                      ConfigMap :: zone_data(),
                      InitialData :: term(),
                      Reason :: term().

Functions

Link to this function

broadcast(ServerRef, Msg)

View Source
-spec broadcast(server_ref(), term()) -> ok.
Link to this function

call(ServerRef, Message)

View Source
-spec call(ServerRef, Message) -> Reply
              when ServerRef :: server_ref(), Message :: term(), Reply :: term().
Link to this function

call(ServerRef, Message, Timeout)

View Source
-spec call(ServerRef, Message, Timeout) -> Reply
              when ServerRef :: server_ref(), Message :: term(), Timeout :: timeout(), Reply :: term().
Link to this function

cast(ServerRef, Message)

View Source
-spec cast(ServerRef, Message) -> ok when ServerRef :: server_ref(), Message :: term().
Link to this function

code_change(OldVsn, St0, Extra)

View Source
Link to this function

disconnect(ServerRef, SessionPID)

View Source
-spec disconnect(server_ref(), session_pid()) -> ok.
Link to this function

handle_call(Call, From, St0)

View Source

Initialize the internal state of the zone, with timer

Link to this function

join(ServerRef, Msg, SessionPID)

View Source
-spec join(server_ref(), term(), session_pid()) -> ok.
Link to this function

part(ServerRef, Msg, SessionPID)

View Source
-spec part(server_ref(), term(), session_pid()) -> ok.
Link to this function

reconnect(ServerRef, SessionPID)

View Source
-spec reconnect(server_ref(), session_pid()) -> ok.
-spec reply(From, Message) -> ok when From :: from(), Message :: term().
Link to this function

rpc(ServerRef, Type, Msg, SessionPID)

View Source
-spec rpc(server_ref(), atom(), term(), session_pid()) -> ok.
Link to this function

send(ServerRef, SessionPIDs, Msg)

View Source
-spec send(server_ref(), [session_pid()], term()) -> ok.
Link to this function

start(Module, Args, Opts)

View Source
-spec start(Module, Args, Opts) -> Result
               when Module :: module(), Args :: term(), Opts :: [start_opt()], Result :: start_ret().
Link to this function

start(ServerName, Module, Args, Opts)

View Source
-spec start(ServerName, Module, Args, Opts) -> Result
               when
                   ServerName :: server_name(),
                   Module :: module(),
                   Args :: term(),
                   Opts :: [start_opt()],
                   Result :: start_ret().
Link to this function

start_link(Module, Args, Opts)

View Source
-spec start_link(Module, Args, Opts) -> Result
                    when
                        Module :: module(), Args :: term(), Opts :: [start_opt()], Result :: start_ret().
Link to this function

start_link(ServerName, Module, Args, Opts)

View Source
-spec start_link(ServerName, Module, Args, Opts) -> Result
                    when
                        ServerName :: server_name(),
                        Module :: module(),
                        Args :: term(),
                        Opts :: [start_opt()],
                        Result :: start_ret().
Link to this function

start_monitor(Module, Args, Opts)

View Source
-spec start_monitor(Module, Args, Opts) -> Result
                       when
                           Module :: module(),
                           Args :: term(),
                           Opts :: [start_opt()],
                           Result :: start_mon_ret().
Link to this function

start_monitor(ServerName, Module, Args, Opts)

View Source
-spec start_monitor(ServerName, Module, Args, Opts) -> Result
                       when
                           ServerName :: server_name(),
                           Module :: module(),
                           Args :: term(),
                           Opts :: [start_opt()],
                           Result :: start_mon_ret().
-spec stop(ServerRef) -> ok when ServerRef :: server_ref().
Link to this function

stop(ServerRef, Reason, Timeout)

View Source
-spec stop(ServerRef, Reason, Timeout) -> ok
              when ServerRef :: server_ref(), Reason :: term(), Timeout :: timeout().