Module engine

Module engine 

Source
Expand description

Deterministic sans-I/O text-message engine.

The engine is a reducer: platform code feeds it commands (compose, receive, transmit updates, archive results, ticks) and drains a bounded queue of effects and events. It never calls a database, sleeps, or transmits directly, so it can be tested without a radio, clock, executor, or platform runtime, and runs identically on mobile and pager targets.

§Output contract

Outputs carry stable IDs and may be re-emitted; platform storage must apply message mutations idempotently (a mutation with a revision not newer than the last applied for its handle is a no-op). Rendered bodies live in an internal arena addressed by BodyRef; drain all outputs after each command — the arena resets once the queue is empty.

Modules§

fragment
Outbound fragmentation planning and fixed-capacity reassembly.
repair
Resend-service bookkeeping: pending archive lookups, response coalescing, and deterministic jitter.
sequence
Per-stream sequence state: serial-number arithmetic, duplicate windows, and wire-ID-to-handle mappings.

Structs§

ArchiveKey
Archive key identifying resendable outbound material.
BodyRef
Reference into the engine’s render arena; resolve with Engine::body. Valid until the output queue has been fully drained.
Engine
The deterministic text engine.
EngineConfig
Tuning knobs. Defaults suit a LoRa mesh; a pager may shrink the windows.
MessageMutation
An idempotent transcript mutation.
StreamCheckpoint
Persisted outbound stream checkpoint.
Transmission
A frame for the platform to transmit.

Enums§

ArchiveResult
Result of an outbound archive lookup.
CompletionStatus
Completeness of a message’s body.
ComposeError
ComposeIntent
What the caller wants to send.
ComposeRef
Reference to a previously composed original for edits and deletes.
DeliveryState
Destination
Where a transmit effect should be sent.
Diagnostic
Non-fatal observations, surfaced for logging and counters.
Direction
Event
Application-visible events.
MutationKind
Output
One drained output: an effect for the platform or an application event.
Presence
Presence of a message’s ordered transcript slot.
ReceiveError
RegardingRef
What a reply or emote is about.
RepairOutcome
ResolvedRef
A protocol-level reference, resolved to a stable handle when unambiguous.

Constants§

MAX_FRAME
Maximum encoded text payload the engine will hand to a transport.

Functions§

destination_for
Delivery mode of a conversation, used for original sends and for resend responses (which return on the conversation’s mode, not the request’s arrival path).