Skip to main content

deep_causality_context_store/
lib.rs

1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
4 */
5
6//! The persistence contract for the DeepCausality context.
7//!
8//! A `Context` in `deep_causality_context` lives in memory. This crate declares what a store
9//! holds to keep one: the records a context projects onto ([`ContextoidRecord`],
10//! [`RelationRecord`], [`ContextSnapshot`] and the [`NodeRecord`] tree under them), the
11//! [`ContextStorage`] trait a backend implements, the [`Recordable`] projection the context crate
12//! implements beside its node types, the [`Substrate`] a reference-holding store keeps values in,
13//! and the [`ContextStorageStream`] a backend adds when it reports changes. Every scalar in a
14//! record is `f64` and every tick `u64`; every identifier is a `u64` the store hands out. The
15//! crate depends on `ultragraph_traits` alone, itself dependency-free, so that [`RelationKind`]
16//! implements `EdgeKey`; a backend links these two crates and never the context crate.
17//! [`utils_test`] holds an in-memory backend for tests on both sides of the contract.
18//!
19//! See <https://docs.deepcausality.com/> for the documentation.
20
21#![cfg_attr(not(feature = "std"), no_std)]
22
23extern crate alloc;
24
25mod alias;
26mod constants;
27mod errors;
28mod traits;
29mod types;
30// In-memory reference backends for the test suites. They lock with `std::sync::Mutex`, so they
31// need `std`; the records and traits do not.
32#[cfg(feature = "std")]
33pub mod utils_test;
34
35//
36// Aliases and constants
37//
38pub use crate::alias::*;
39pub use crate::constants::*;
40//
41// Error types
42//
43pub use crate::errors::*;
44//
45// Traits
46//
47pub use crate::traits::context_events::{ContextEventItem, ContextEvents};
48pub use crate::traits::context_storage::ContextStorage;
49pub use crate::traits::context_storage_stream::ContextStorageStream;
50pub use crate::traits::recordable::Recordable;
51pub use crate::traits::substrate::Substrate;
52//
53// Records
54//
55pub use crate::types::container_ref::ContainerRef;
56pub use crate::types::context_event::ContextEvent;
57pub use crate::types::context_write::ContextWrite;
58pub use crate::types::id_reserve::IdReserve;
59pub use crate::types::records::context_record::ContextRecord;
60pub use crate::types::records::context_snapshot::ContextSnapshot;
61pub use crate::types::records::contextoid_record::ContextoidRecord;
62pub use crate::types::records::data_record::DataRecord;
63pub use crate::types::records::extra_context_snapshot::ExtraContextSnapshot;
64pub use crate::types::records::node_record::NodeRecord;
65pub use crate::types::records::relation_record::RelationRecord;
66pub use crate::types::records::space_record::SpaceRecord;
67pub use crate::types::records::space_time_record::SpaceTimeRecord;
68pub use crate::types::records::time_record::TimeRecord;
69//
70// Vocabulary shared with the context node types
71//
72pub use crate::types::relation_kind::RelationKind;
73pub use crate::types::substrate_ref::SubstrateRef;
74pub use crate::types::time_scale::TimeScale;
75pub use crate::types::vertical_datum::VerticalDatum;