Juvix imports
module arch.node.engines.local_key_value_storage;
import prelude open;
import arch.node.types.engine open;
import arch.node.engines.local_key_value_storage_messages open public;
import arch.node.engines.local_key_value_storage_environment open public;
import arch.node.engines.local_key_value_storage_behaviour open public;
import arch.node.engines.local_key_value_storage_config open public;
import arch.node.types.anoma as Anoma open;
open local_key_value_storage_config_example;
open local_key_value_storage_environment_example;
Local Key-Value Storage Engine¶
The Local Key-Value Storage Engine handles persistent storage and retrieval of data in a key-value format on the local machine.
Purpose¶
The Local Key-Value Storage Engine provides local storage and retrieval of data in a key-value format. It supports storing, retrieving and deleting key-value pairs while notifying interested parties of changes.
Components¶
- Local Key Value Storage Messages
- Local Key Value Storage Configuration
- Local Key Value Storage Environment
- Local Key Value Storage Behaviour
Type¶
LocalKVStorageEngine : Type :=
Engine
LocalKVStorageCfg
LocalKVStorageLocalState
LocalKVStorageMailboxState
LocalKVStorageTimerHandle
LocalKVStorageActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;
Example of a local key-value storage engine¶
exampleLocalKVStorageEngine : LocalKVStorageEngine :=
mkEngine@{
cfg := localKVStorageCfg;
env := localKVStorageEnv;
behaviour := localKVStorageBehaviour;
};
where localKVStorageCfg
is defined as follows:
localKVStorageCfg : EngineCfg LocalKVStorageCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "key value storage";
cfg := mkLocalKVStorageCfg;
};
localKVStorageEnv
is defined as follows:
localKVStorageEnv : LocalKVStorageEnv :=
mkEngineEnv@{
localState :=
mkLocalKVStorageLocalState@{
storage := Map.empty;
localClock := 0;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};
and localKVStorageBehaviour
is defined as follows:
localKVStorageBehaviour : LocalKVStorageBehaviour :=
mkEngineBehaviour@{
guards := First [getValueGuard; setValueGuard; deleteValueGuard];
};