Skip to content
Juvix imports

module arch.node.engines.local_time_series_storage;

import prelude open;
import arch.node.types.engine open;
import arch.node.engines.local_time_series_storage_messages open public;
import arch.node.engines.local_time_series_storage_config open public;
import arch.node.engines.local_time_series_storage_environment open public;
import arch.node.engines.local_time_series_storage_behaviour open public;
import arch.node.types.anoma as Anoma open;

open local_ts_storage_config_example;
open local_ts_storage_environment_example;

Local Time Series Storage Engine

The Local Time Series Storage Engine provides local storage and retrieval of time series data.

Purpose

The Local Time Series Storage Engine manages local storage and retrieval of time series data. It provides functions for recording new data, retrieving existing data, and deleting data when needed.

Components

Type

LocalTSStorageEngine : Type :=
Engine
LocalTSStorageCfg
LocalTSStorageLocalState
LocalTSStorageMailboxState
LocalTSStorageTimerHandle
LocalTSStorageActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a local time series storage engine

exampleLocalTSStorageEngine : LocalTSStorageEngine :=
mkEngine@{
cfg := localTSStorageCfg;
env := localTSStorageEnv;
behaviour := localTSStorageBehaviour;
};

where localTSStorageCfg is defined as follows:

localTSStorageCfg : EngineCfg LocalTSStorageCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "local time series storage";
cfg := mkLocalTSStorageCfg;
};

localTSStorageEnv is defined as follows:

localTSStorageEnv : LocalTSStorageEnv :=
mkEngineEnv@{
localState :=
mkLocalTSStorageLocalState@{
db := "";
localClock := 0;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and localTSStorageBehaviour is defined as follows:

localTSStorageBehaviour : LocalTSStorageBehaviour :=
mkEngineBehaviour@{
guards := First [getDataGuard; recordDataGuard; deleteDataGuard];
};