vertep_runtime/lib.rs
1//! Event-sourced actor runtime for Vertep.
2//!
3//! A chart becomes a durable actor: addressed by an IRI, fed through a mailbox, run one SCXML
4//! macrostep per turn by the pure `vertep_core::session::step`, and made durable by appending
5//! one journal entry per turn to a [`vertep_store::JournalStore`] with compare-and-set. The
6//! runtime is an imperative shell around that pure core: it owns time ([`shell::Clock`]),
7//! background work ([`shell::Spawn`]) and waiting ([`shell::Sleep`]), all injectable, so tests
8//! run on a virtual clock.
9//!
10//! - [`node`]: the scheduler of one process: virtual actors (activated on message, deactivated
11//! when idle, at most one activation per node), invoked actors (`<invoke>` children with
12//! `vt:restart` supervision), stateless worker pools, the transactional outbox, durable
13//! timers, snapshots, replay, migrations, forks and time travel.
14//! - [`machine`]: the deterministic macrostep used by live turns and replay alike.
15//! - [`journal`]: journal entries as RDF datasets in `vt:` terms.
16//! - [`mailbox`], [`transport`]: pluggable mailboxes (in-memory, store-backed), transports
17//! registered as SCXML Event I/O Processors, and the directory of resolvers.
18//! - [`actor`]: the actor contract and its chart, function and stream adapters.
19//! - [`chart`]: chart versions, the registry, `vt:` extension lowering and migrations.
20//! - [`ontology`]: the runtime ontology module and its SHACL shapes.
21//! - [`placement`]: the hook a cluster uses to place virtual actors and workers on nodes.
22//! - [`websocket`]: the WebSocket Event I/O Processor's frames and links, and its server end
23//! (feature `websocket`).
24//!
25//! @tg: implements:: [[decisions#SCXML-native actors with vt extensions]]
26//! @tg: implements:: [[decisions#IRI identity and lifecycle classes]]
27//! @tg: implements:: [[decisions#Identity, mailbox and transport layers]] {confidence: partial, note: "local transport only; DID and relay mailboxes are M5"}
28//! @tg: implements:: [[decisions#Event-sourced actors]]
29//! @tg: implements:: [[decisions#Content-addressed chart versions]]
30//! @tg: implements:: [[decisions#No-std core and tokio shell]]
31//! @tg: implements:: [[decisions#Non-blocking request and deferred events]]
32//! @tg: implements:: [[decisions#State changes travel in the append]]
33//! @tg: implements:: [[decisions#Fencing epochs on journal appends]] {confidence: partial, note: "the configured token is passed on every append; leases are M4"}
34
35pub mod actor;
36pub mod address;
37pub mod chart;
38pub mod journal;
39pub mod json;
40pub mod machine;
41pub mod mailbox;
42pub mod node;
43pub mod ontology;
44pub mod placement;
45pub mod shell;
46pub mod storage;
47pub mod transport;
48pub mod vocab;
49pub mod websocket;
50
51pub use actor::{
52 Actor, ActorFactory, ActorFailure, ActorFn, ActorInput, ActorStart, ChartActor, FnActor,
53 OutTarget, Outgoing, StreamActor, Turn, TurnOutput,
54};
55pub use address::{Address, AddressError};
56pub use chart::{ChartInfo, ChartRegistry, Migration, RegisterError, UnhandledPolicy};
57pub use journal::{EntryBody, EntryData, TimerRecord};
58pub use mailbox::{Envelope, Mailbox, MailboxFactory, MemoryMailboxes, StoreMailboxes};
59pub use node::{
60 ActivationError, ActorState, AskError, CrashPoint, DeadLetter, DeliveryError, MigrateError,
61 Node, NodeBuilder, NodeConfig, NodeHandle, NodeStats, RemoveError,
62};
63pub use placement::{Placement, Route};
64pub use shell::{Clock, Shell, Sleep, Spawn, VirtualClock};
65pub use storage::{SplitStorage, Storage};
66pub use transport::{LocalTransport, Resolver, Transport};
67
68/// The chart RDF crate (version IRIs).
69pub use vertep_rdf;
70/// The storage contracts.
71pub use vertep_store;
72
73#[cfg(doctest)]
74#[doc = include_str!("../README.md")]
75struct ReadmeDoctests;