Skip to content
Juvix imports

module arch.node.engines.reads_for;

import prelude open;
import arch.node.types.engine open;
import arch.node.engines.reads_for_messages open public;
import arch.node.engines.reads_for_environment open public;
import arch.node.engines.reads_for_behaviour open public;
import arch.node.engines.reads_for_config open public;
import arch.node.engines.reads_for_messages open public;
import arch.node.engines.reads_for_environment open public;
import arch.node.engines.reads_for_behaviour open public;
import arch.node.types.anoma as Anoma open;

open reads_for_config_example;
open reads_for_environment_example;

Reads For Engine

The Reads For Engine manages reads_for relationships between identities. A reads_for relationship indicates that one identity can read data encrypted for another identity.

Purpose

The Reads For Engine maintains and manages the state of reads_for relationships between identities. It handles queries about these relationships, allows submission of new evidence, and provides information about existing relationships. This is useful in scenarios where data access needs to be delegated or shared.

Components

  • Reads For Messages
  • Reads For Config
  • Reads For Environment
  • Reads For Behaviour

Type

ReadsForEngine : Type :=
Engine
ReadsForCfg
ReadsForLocalState
ReadsForMailboxState
ReadsForTimerHandle
ReadsForActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a reads for engine

exampleReadsForEngine : ReadsForEngine :=
mkEngine@{
cfg := readsForCfg;
env := readsForEnv;
behaviour := readsForBehaviour;
};

where readsForCfg is defined as follows:

readsForCfg : EngineCfg ReadsForCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "reads for";
cfg := mkReadsForCfg;
};

readsForEnv is defined as follows:

readsForEnv : ReadsForEnv :=
mkEngineEnv@{
localState :=
mkReadsForLocalState@{
evidenceStore := Set.empty;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and readsForBehaviour is defined as follows:

readsForBehaviour : ReadsForBehaviour :=
mkEngineBehaviour@{
guards :=
First [readsForQueryGuard; submitEvidenceGuard; queryEvidenceGuard];
};