Bardo.ScapeManager.Sector behaviour (Bardo v0.1.0)

View Source

Sectors are the subcomponents/processes that make up a Scape.

See the Scape module for a description of what is a Scape.

Summary

Functions

Perform various sector functions e.g. move, push, etc. The sector API is problem dependent. This function provides an interface to call various functions defined by the sector in question.

Returns a specification to start this module under a supervisor.

Delete entire table.

Delete object.

Return all objects.

Lookup object.

Insert Agent into sector.

Remove Agent from sector.

Gather sensory inputs from the environment.

Starts the Sector process.

Sends a signal to the Sector process requesting it to stop.

Insert object.

Types

mod_name()

@type mod_name() :: {:public, atom()}

mod_state()

@type mod_state() :: any()

scape_id()

@type scape_id() :: atom() | float() | {float(), :scape} | {atom(), :scape}

Callbacks

actuate(agent_id, function, params, state)

@callback actuate(
  agent_id :: Bardo.Models.agent_id(),
  function :: atom(),
  params :: any(),
  state :: mod_state()
) :: {result :: {[float()], integer() | atom()}, new_mod_state :: mod_state()}

enter(agent_id, params, state)

@callback enter(
  agent_id :: Bardo.Models.agent_id(),
  params :: any(),
  state :: mod_state()
) ::
  {result :: :success | nil, new_mod_state :: mod_state()}

init(params)

@callback init(params :: any()) :: {:ok, initial_mod_state :: mod_state()}

insert(agent_id, params, mod_state)

(optional)
@callback insert(
  agent_id :: Bardo.Models.agent_id(),
  params :: any(),
  mod_state :: mod_state()
) ::
  {:ok, new_mod_state :: mod_state()}

leave(agent_id, params, state)

@callback leave(
  agent_id :: Bardo.Models.agent_id(),
  params :: any(),
  state :: mod_state()
) ::
  {:ok, new_mod_state :: mod_state()}

remove(agent_id, mod_state)

(optional)
@callback remove(agent_id :: Bardo.Models.agent_id(), mod_state :: mod_state()) ::
  {result :: any(), new_mod_state :: mod_state()}

sense(agent_id, params, sensor_pid, state)

@callback sense(
  agent_id :: Bardo.Models.agent_id(),
  params :: any(),
  sensor_pid :: pid(),
  state :: mod_state()
) :: {result :: atom() | [float()], new_mod_state :: mod_state()}

terminate(reason, mod_state)

(optional)
@callback terminate(reason :: atom(), mod_state :: mod_state()) :: :ok

Functions

actuate(uid, agent_id, function, actuator_pid, params)

@spec actuate(integer() | atom(), Bardo.Models.agent_id(), atom(), pid(), any()) ::
  :ok

Perform various sector functions e.g. move, push, etc. The sector API is problem dependent. This function provides an interface to call various functions defined by the sector in question.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(table)

@spec delete(:t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10) :: true

Delete entire table.

delete(table, key)

@spec delete(:t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10, term()) ::
  true

Delete object.

enter(uid, agent_id, params)

@spec enter(integer() | atom(), Bardo.Models.agent_id(), any()) :: :ok

Enter sector.

fetch(table)

@spec fetch(:t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10) :: list()

Return all objects.

fetch(table, key)

@spec fetch(:t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10, term()) ::
  list()

Lookup object.

insert(uid, agent_id, params)

@spec insert(integer() | atom(), Bardo.Models.agent_id(), any()) :: :ok

Insert Agent into sector.

leave(uid, agent_id, params)

@spec leave(integer() | atom(), Bardo.Models.agent_id(), any()) :: :ok

Leave sector.

remove(uid, agent_id)

@spec remove(integer() | atom(), Bardo.Models.agent_id()) :: any()

Remove Agent from sector.

sense(uid, agent_id, sensor_pid, params)

@spec sense(integer() | atom(), Bardo.Models.agent_id(), pid(), any()) :: :ok

Gather sensory inputs from the environment.

start_link(mod, uid)

@spec start_link(atom(), integer() | atom()) :: {:ok, pid()}

Starts the Sector process.

stop(uid)

@spec stop(integer() | atom()) :: :ok

Sends a signal to the Sector process requesting it to stop.

store(table, value)

@spec store(:t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10, term()) ::
  true

Insert object.

update_counter(table, key, update_op, default)

@spec update_counter(
  :t1 | :t2 | :t3 | :t4 | :t5 | :t6 | :t7 | :t8 | :t9 | :t10,
  term(),
  tuple(),
  tuple()
) :: integer()

Update counter.