Skip to main content

harmos_runtime/
lib.rs

1/* ***
2 *
3 * Harmos
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * ***
8 */
9
10/* === Modules === */
11
12pub(crate) use harmos_storage::aggregate;
13pub mod builtin;
14pub mod config;
15mod error;
16pub mod filesystem;
17#[cfg(feature = "grpc")]
18pub mod grpc;
19pub mod prelude;
20pub mod storage;
21
22mod application;
23
24pub mod evidence;
25
26pub mod state;
27
28pub mod records;
29
30#[cfg(all(not(target_arch = "wasm32"), feature = "plugin"))]
31pub mod plugin;
32
33#[cfg(all(not(target_arch = "wasm32"), feature = "plugin-sidecar"))]
34pub mod sidecar;
35
36#[cfg(all(not(target_arch = "wasm32"), feature = "plugin-guest"))]
37pub mod guest;
38
39pub mod operations;
40
41pub mod runtime;
42
43#[cfg(feature = "simulation")]
44pub mod simulation;
45
46pub mod streams;
47
48pub mod services;
49
50pub mod observers;
51
52mod supervision;
53
54pub mod __private {
55    pub use harmos_domain::config::SchemaSettings;
56    pub use harmos_domain::plugin::schema_markers as PluginSchemaMarkers;
57    pub extern crate serde;
58    pub extern crate serde_json;
59    pub use harmos_domain::__private::CarrierContext;
60    pub use harmos_domain::__private::{
61        MessageError, PostcardReader, PostcardValue, decoding_add, decoding_multiply, decoding_vector, postcard_product,
62    };
63    pub use harmos_domain::declare;
64    pub use harmos_domain::inventory as PluginInventory;
65    pub use harmos_domain::{Registrar as PluginRegistrar, RegistrationError as PluginRegistrationError};
66    pub use harmos_sdk::plugin::{
67        Contribution as PluginContribution, Declared as PluginDeclared, Grant as PluginGrant, Requirement as PluginRequirement,
68        Requirements as PluginRequirements,
69    };
70    #[cfg(feature = "plugin-sidecar")]
71    pub use harmos_sidecar as sidecar;
72
73    // A stream declaration is authored wherever its row type is, host core or
74    // no host core, so these three are as unconditional as the attribute that
75    // generates them.
76    pub use harmos_domain::streams::{BatchDefinition, StreamCatalog, StreamRow};
77    // How generated code names a type the tokens it was handed cannot spell.
78    // Ungated on purpose: a hand-written contribution in a crate that compiles
79    // no authoring attributes at all still resolves the same paths.
80
81    pub use crate::state::{Catalogued, Mutual};
82    pub use harmos_domain::__private::Answer;
83
84    pub fn stream_definition<S: StreamRow>(id: &'static str, version: u32, window: usize) -> crate::streams::Definition {
85        crate::streams::Definition::declared::<S>(id, version, window)
86            .batching(S::batch_definition())
87            .presentation(S::metadata(), S::row_metadata())
88    }
89}
90
91/* === Re-Exports === */
92
93pub use application::Application;
94pub use error::{BackendFailure, Error};
95pub use harmos_domain::{DefinitionId, Identified};
96
97#[cfg(feature = "signal")]
98pub use harmos_storage::signal;
99
100pub use operations::refusal::Refusal;
101pub use runtime::{Builder, Runtime};
102
103pub use harmos_domain::{
104    Aggregate, Failure, Identifier, IdentifierError, MemorySize, Message, MessageError, Metadata, RowMetadata, Storable, StreamField,
105    StreamSpec, Value, ValueError, btree_map_memory,
106};
107pub use harmos_sdk::plugin::Plugin;
108// Contract Namespaces The Host Does Not Extend, Re-Exported Whole.
109
110// `message` Names Both The Contract Module And Its Same-Named Attribute.
111pub use harmos_domain::{artifacts, catalog, failure, listeners, message, schema};
112pub use harmos_macros::{lanes, listener, observer, operation, plugin, record, records, stream, streams, transaction, transactions};
113
114/* === Imports === */
115
116// Standard Library Imports
117
118// Third Party Imports
119extern crate self as harmos;
120extern crate self as harmos_runtime;
121// Local Imports
122
123/* === Constants === */
124
125/* === Macros === */
126
127/* === Type Aliases === */
128
129pub type Result<T, E = std::convert::Infallible> = std::result::Result<T, Error<E>>;
130
131/* === Structs === */
132
133/* === Enums === */
134
135/* === Traits === */
136
137/* === Implementations === */
138
139/* === Public Functions === */
140
141/* === Private Functions === */
142
143/* === Tests === */