bot_army v1.0.0 BotArmy.SharedData View Source
While the "context" lets you share state between actions, SharedData
lets you
share state between bots. In addition, it is a central place to hold global data,
like runtime config data.
This module is a simple wrapper around a basic ETS table. As noted above, the runner tasks/router will store runtime config here as well.
Note that this does not supply any kind of locking mechanism, so be aware of race conditions. This is by design for two reasons. First, config is a read-only use case. Second, for data-sharing, bots represent users, which operate independently of each other in real life with async data sharing patterns (email, slack).
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Get a value by key (returns nil
if not found)
Put a value by key.
Update a value by key. update_fn
is val -> val.
Link to this section Functions
child_spec(arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
get(key) View Source
Get a value by key (returns nil
if not found)
put(key, value) View Source
Put a value by key.
update(key, update_fn) View Source
Update a value by key. update_fn
is val -> val.