Skip to content
okebkal edited this page Apr 1, 2016 · 4 revisions

MODULE

fsm_worker

MODULE SUMMARY

Generic fsm_worker behaviour

DESCRIPTION

DATA TYPES

role_id() =
  {Role :: atom(),
   RoleID :: atom(),
   MiddleMan :: mm(),  %% see role_worker
   Flag :: true | false,
   Params :: [any()]}

sm() = 
  #sm{id = atom(),
      table = tab(),
      share = tab(),
      dets_share = tab_name(),
      roles = [role_id()],
      module = atom(),
      env = #{},
      state = atom(),
      event = atom(),
      event_params = any(),
      stack = [atom()],
      final = [atom()],
      timeouts = [{Event :: atom(), TRef :: tref()}] %% see timer library for tref()

EXPORTS

role_info(RoleIDs, Roles) -> Result

Types

  RoleIDs = [role_id()]
  Roles = atom() || [atom()]
  Result = [role_id()]

CALLBACK FUNCTIONS

The following functions must be exported from a fsm_worker callback module.

EXPORTS

Module::start(ModID, RoleIDs, SupID, {Mod, Fun, ArgS}) -> Result

Types

  ModID = atom
  RoleIDs = [role_id()]
  SupID = atom
  Mod = atom
  Fun = atom
  ArgS = any()
  Result = {ok,pid()} | ignore | {error,any()}
Module::register_fsms(ModID, RoleIDs, Share, ArgS) -> Result

Types

  ModID = atom
  RoleIDs = [role_id()]
  Share = tab() %% see ets library
  ArgS = [any()]
  Result = [sm()]

SEE ALSO

fsm, role_worker