agala v3.0.0 Agala.Bot.Storage

This module represent permanent storage system for Agala bot.

The problem

Sometimes, some bot parts can shut down because of internal errors. It has no sense to handle this errors in letitcrash approach. Thus, bot should have the place to store some data that should not be lost during restarts.

Of course, developer should implement his own storage for business logic, but providers can use this storage to save internal data.

Implementation

Agala.Storage has two methods: set/3 and get/2. This methods are used to keep and retrieve data.

If this storage is fundamental, it’s lifecycle will be unlinked from Agala.Bot instance. But, you can implement optional child_spec/1 method. In this case, the Agala.Storage module will be started inside Agala.Bot supervision tree.

Link to this section Summary

Link to this section Functions

Link to this function get(bot, key)
get(bot :: Agala.Bot.t(), key :: Map.key()) :: any()
Link to this function set(bot, key, value)
set(bot :: Agala.Bot.t(), key :: Map.key(), value :: Map.value()) ::
  {:ok, Map.value()}