View Source SpawnSdk.System behaviour (spawn_sdk v2.0.0-RC4)

System defines the general behavior of the Spawn actor system. It is through System implementations that the user can register, invoke, and perform other activities with their Actors.

Summary

Types

action()

@type action() :: String.t()

actor_mod()

@type actor_mod() :: module()

actor_name()

@type actor_name() :: String.t()

actors()

@type actors() :: [actor_mod()]

invoke_opts()

@type invoke_opts() :: [
  action: action(),
  ref: actor_mod(),
  payload: payload(),
  system: system(),
  async: boolean()
]

payload()

@type payload() :: struct()

spawn_actor_opts()

@type spawn_actor_opts() :: [actor: actor_mod(), system: system()]

system()

@type system() :: String.t()

Callbacks

invoke(actor_name, invoke_opts)

@callback invoke(actor_name(), invoke_opts()) :: {:ok, term()} | {:error, term()}

register(system, actors)

@callback register(system(), actors()) :: :ok | {:error, term()}

spawn_actor(actor_name, spawn_actor_opts)

@callback spawn_actor(actor_name(), spawn_actor_opts()) ::
  {:ok, term()} | {:error, term()}