Skip to content

Ticker Environment

Juvix preamble

module node_architecture.engines.ticker_environment;

import prelude open;
import node_architecture.types.basics open;
import node_architecture.engines.ticker_messages open;
import node_architecture.types.engine_environment open;

Overview

The sole data item of the ticker environment that deserves mention is the counter; we do not need timers, or mailbox state.

Mailbox states

syntax alias TickerMailboxState := Unit;

Local state

type TickerLocalState : Type := mkTickerLocalState {counter : Nat};

Timer Handle

syntax alias TickerTimerHandle := Unit;

The ticker does not require a timer handle type. Therefore, we define the timer handle type as Unit.

Environment summary

TickerEnvironment : Type :=
EngineEnvironment TickerLocalState TickerMailboxState TickerTimerHandle;

Example of a Ticker environment

tickerEnvironmentExample : TickerEnvironment :=
mkEngineEnvironment@{
name := "ticker";
localState :=
mkTickerLocalState@{
counter := 0
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := []
};