Skip to main content

vertep_runtime/
vocab.rs

1//! The `vt:` runtime terms, as declared by `vertep-rdf/ontology/vt-runtime.ttl`.
2//!
3//! The storage layer's own terms (`vt:JournalEntry`, `vt:actor`, `vt:position`, `vt:head`,
4//! `vt:fencingEpoch`, `vt:projectedPosition`, graph `vt:projection`) are re-exported from
5//! [`vertep_store::vocab`], so both crates write the same IRIs.
6
7use oxrdf::NamedNode;
8
9pub use vertep_store::vocab::{
10    ACTOR, FENCING_EPOCH, HEAD, JOURNAL_ENTRY, POSITION, PROJECTED_POSITION, PROJECTION_GRAPH,
11    RDF_TYPE, VT,
12};
13
14macro_rules! terms {
15    ($($(#[$m:meta])* $name:ident = $local:literal;)*) => {
16        $($(#[$m])* pub const $name: &str = concat!("https://w3id.org/vertep/vt#", $local);)*
17        /// Every runtime term this module names, for checks against the ontology file.
18        pub const ALL: &[&str] = &[$($name),*];
19    };
20}
21
22terms! {
23    /// `vt:Address`.
24    ADDRESS = "Address";
25    /// `vt:Actor`.
26    ACTOR_CLASS = "Actor";
27    /// `vt:VirtualActor`.
28    VIRTUAL_ACTOR = "VirtualActor";
29    /// `vt:InvokedActor`.
30    INVOKED_ACTOR = "InvokedActor";
31    /// `vt:StatelessWorker`.
32    STATELESS_WORKER = "StatelessWorker";
33    /// `vt:chartType`.
34    CHART_TYPE = "chartType";
35    /// `vt:key`.
36    KEY = "key";
37    /// `vt:parent`.
38    PARENT = "parent";
39    /// `vt:status`.
40    STATUS = "status";
41    /// `vt:Running`.
42    RUNNING = "Running";
43    /// `vt:Terminated`.
44    TERMINATED = "Terminated";
45    /// `vt:inState`.
46    IN_STATE = "inState";
47    /// `vt:datamodelState`.
48    DATAMODEL_STATE = "datamodelState";
49    /// `vt:tookTransition`.
50    TOOK_TRANSITION = "tookTransition";
51    /// `vt:causedBy`.
52    CAUSED_BY = "causedBy";
53    /// `vt:Mailbox`.
54    MAILBOX = "Mailbox";
55    /// `vt:Message`.
56    MESSAGE = "Message";
57    /// `vt:recipient`.
58    RECIPIENT = "recipient";
59    /// `vt:sequence`.
60    SEQUENCE = "sequence";
61    /// `vt:envelope`.
62    ENVELOPE = "envelope";
63    /// `vt:Activation`.
64    ACTIVATION = "Activation";
65    /// `vt:InputEntry`.
66    INPUT_ENTRY = "InputEntry";
67    /// `vt:MigrationEntry`.
68    MIGRATION_ENTRY = "MigrationEntry";
69    /// `vt:ForkEntry`.
70    FORK_ENTRY = "ForkEntry";
71    /// `vt:Macrostep`.
72    MACROSTEP = "Macrostep";
73    /// `vt:InputEvent`.
74    INPUT_EVENT = "InputEvent";
75    /// `vt:OutgoingSend`.
76    OUTGOING_SEND = "OutgoingSend";
77    /// `vt:chartVersion`.
78    CHART_VERSION = "chartVersion";
79    /// `vt:messageId`.
80    MESSAGE_ID = "messageId";
81    /// `vt:timestamp`.
82    TIMESTAMP = "timestamp";
83    /// `vt:configurationDigest`.
84    CONFIGURATION_DIGEST = "configurationDigest";
85    /// `vt:terminatedHere`.
86    TERMINATED_HERE = "terminatedHere";
87    /// `vt:unhandled`.
88    UNHANDLED = "unhandled";
89    /// `vt:input`.
90    INPUT = "input";
91    /// `vt:send`.
92    SEND = "send";
93    /// `vt:schedules`.
94    SCHEDULES = "schedules";
95    /// `vt:cancels`.
96    CANCELS = "cancels";
97    /// `vt:firedTimer`.
98    FIRED_TIMER = "firedTimer";
99    /// `vt:invokes`.
100    INVOKES = "invokes";
101    /// `vt:eventName` (shared with the chart module).
102    EVENT_NAME = "eventName";
103    /// `vt:eventType`.
104    EVENT_TYPE = "eventType";
105    /// `vt:sendId` (shared with the chart module).
106    SEND_ID = "sendId";
107    /// `vt:invokeId` (shared with the chart module).
108    INVOKE_ID = "invokeId";
109    /// `vt:sendTarget` (shared with the chart module).
110    SEND_TARGET = "sendTarget";
111    /// `vt:order` (shared with the chart module).
112    ORDER = "order";
113    /// `vt:origin`.
114    ORIGIN = "origin";
115    /// `vt:originType`.
116    ORIGIN_TYPE = "originType";
117    /// `vt:originVerified`.
118    ORIGIN_VERIFIED = "originVerified";
119    /// `vt:payload`.
120    PAYLOAD = "payload";
121    /// `vt:sendType`.
122    SEND_TYPE = "sendType";
123    /// `vt:correlationId`.
124    CORRELATION_ID = "correlationId";
125    /// `vt:answers`.
126    ANSWERS = "answers";
127    /// `vt:requests`.
128    REQUESTS = "requests";
129    /// `vt:Snapshot`.
130    SNAPSHOT = "Snapshot";
131    /// `vt:snapshotOf`.
132    SNAPSHOT_OF = "snapshotOf";
133    /// `vt:sessionState`.
134    SESSION_STATE = "sessionState";
135    /// `vt:runtimeState`.
136    RUNTIME_STATE = "runtimeState";
137    /// `vt:Timer`.
138    TIMER = "Timer";
139    /// `vt:Reminder`.
140    REMINDER = "Reminder";
141    /// `vt:dueAt`.
142    DUE_AT = "dueAt";
143    /// `vt:period`.
144    PERIOD = "period";
145    /// `vt:reminderName`.
146    REMINDER_NAME = "reminderName";
147    /// `vt:scheduledBy`.
148    SCHEDULED_BY = "scheduledBy";
149    /// `vt:dispatched`.
150    DISPATCHED = "dispatched";
151    /// `vt:dispatchedThrough`.
152    DISPATCHED_THROUGH = "dispatchedThrough";
153    /// `vt:Migration`.
154    MIGRATION = "Migration";
155    /// `vt:migration`.
156    MIGRATION_P = "migration";
157    /// `vt:fromVersion`.
158    FROM_VERSION = "fromVersion";
159    /// `vt:toVersion`.
160    TO_VERSION = "toVersion";
161    /// `vt:snapshotBefore`.
162    SNAPSHOT_BEFORE = "snapshotBefore";
163    /// `vt:snapshotAfter`.
164    SNAPSHOT_AFTER = "snapshotAfter";
165    /// `vt:snapshot`.
166    SNAPSHOT_P = "snapshot";
167    /// `vt:forkOf`.
168    FORK_OF = "forkOf";
169    /// `vt:forkPosition`.
170    FORK_POSITION = "forkPosition";
171    /// `vt:DeadLetter`.
172    DEAD_LETTER = "DeadLetter";
173    /// `vt:receiver`.
174    RECEIVER = "receiver";
175    /// `vt:sender`.
176    SENDER = "sender";
177    /// `vt:reason`.
178    REASON = "reason";
179    /// `vt:recordedAt`.
180    RECORDED_AT = "recordedAt";
181}
182
183/// The type IRI of `vt:request` sends: a send of this type (with `;timeout=<ms>` appended when
184/// a timeout is declared) is a request whose correlation id the runtime assigns.
185pub const REQUEST_SEND_TYPE: &str = "https://w3id.org/vertep/vt#request";
186/// The type IRI of `vt:reminder` registrations (with `;name=..;period=..` or `;cancel`).
187pub const REMINDER_SEND_TYPE: &str = "https://w3id.org/vertep/vt#reminder";
188/// The type IRI of self-migration requests (with `;to=<version>;migration=<iri>`).
189// @tg: implements:: [[openspec:chart-versioning#Self-Migration Requests]]
190pub const MIGRATE_SEND_TYPE: &str = "https://w3id.org/vertep/vt#migrate";
191/// The event name of a reply to a `vt:request`; the runtime copies the request's correlation id
192/// onto every `vt:reply` sent while the request is being handled.
193pub const REPLY_EVENT: &str = "vt:reply";
194/// The event a request's timeout timer raises.
195pub const TIMEOUT_EVENT: &str = "error.timeout";
196/// The event raised by the `error` unhandled-event policy.
197pub const UNHANDLED_EVENT: &str = "error.unhandled";
198
199/// A [`NamedNode`] for one of the constants above.
200pub fn node(iri: &str) -> NamedNode {
201    NamedNode::new_unchecked(iri)
202}