Skip to content
Juvix imports

module arch.node.net.storage;

import arch.node.net.storage_messages open public;
import arch.node.net.storage_config open public;
import arch.node.net.storage_environment open public;
import arch.node.net.storage_behaviour open public;
import arch.node.types.basics open;
import arch.node.types.engine open;
import arch.node.types.anoma as Anoma open;

open storage_config_example;
open storage_environment_example;
open storage_behaviour_example;

Storage Engine

Purpose

The Storage engine implements distributed object storage. Each stored object is encrypted using convergent encryption with a key derived from the hash of the content and a secret key, then the ciphertext is split into equal-sized parts, and organized in a Merkle-tree.

A Chunk is a Merkle-tree node that is stored by nodes, with an associated access control list that may limit access to the chunk to a list of nodes, e.g. publisher or subscribers of a Topic.

Nodes may commit to store a Chunk via a ChunkCommitment sent to a pub/sub Topic, and keep track of known commitments by other nodes. This allows nodes to respond to chunk requests with either the chunk itself if available locally, or with a ChunkCommitment by a node that stores the requested chunk. Brief summary of the purpose of the engine.

Components

  • Some
  • Useful
  • Links

Type

StorageEngine : Type :=
Engine
StorageLocalCfg
StorageLocalState
StorageMailboxState
StorageTimerHandle
StorageActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

exStorageEngine : StorageEngine :=
mkEngine@{
cfg := exStorageCfg;
env := exStorageEnv;
behaviour := exStorageBehaviour;
};

Where exStorageCfg is defined as follows:

exStorageCfg : StorageCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "storage";
cfg := mkStorageLocalCfg;
};

exStorageEnv is defined as follows:

exStorageEnv : StorageEnv :=
mkEngineEnv@{
localState := mkStorageLocalState;
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and exStorageBehaviour is defined as follows:

module storage_behaviour_example;
exStorageBehaviour : StorageBehaviour :=
mkEngineBehaviour@{
guards := First [exampleReplyGuard];
};
end;