somatize_core/lib.rs
1//! The soma core: the graph structure, the contracts for what gets
2//! executed, the shape of an execution, and the engine that walks it.
3//!
4//! No `#[pyclass]` here. The moment a core type carries one, it can no longer
5//! be used without a Python interpreter loaded, and that does not come undone.
6//!
7//! The pieces and their roles, which are easy to confuse:
8//!
9//! | piece | role |
10//! |---|---|
11//! | [`Graph`] | the **structure**: which nodes exist and how they connect. Pure data |
12//! | [`Catalog`] | the **store**: which implementation belongs to each node |
13//! | [`Placement`] | **where** each node runs. Pure data, and separate from the plan |
14//! | [`Memory`] | **what is remembered** of each node: what it is, whether it is frozen, whether its output is kept |
15//! | [`Device`] | the place inside a machine: `cpu`, `cuda:0`, `meta` |
16//! | [`Host`] | the place that **is** another machine or process, by name |
17//! | [`Node`] | the **contract** for what a node executes |
18//! | [`Transport`] | who **carries** a slice of plan to another host |
19//! | [`Keeper`] | who **hashes** a recipe and **keeps** what it names |
20//! | [`Watcher`] | who is **told** what happened, as it happens |
21//! | [`Fact`] | one thing that happened, in the engine's vocabulary |
22//! | [`Plan`] | the **decided shape** of an execution |
23//! | [`Step`], [`Destination`] | the two ways of walking one: what it does, and where |
24//! | [`compile`] | from the structure to the shape |
25//! | [`distribute`] | and from the placement, which slices travel together |
26//! | [`Executor`] | the **engine** |
27//! | [`Wire`] | declaring a graph as an expression: `a >> (b \| c) >> d` |
28//!
29//! One file per type, with its inherent `impl`s and the errors its operations
30//! produce. See `CLAUDE.md`.
31
32#![forbid(unsafe_code)]
33#![warn(missing_docs)]
34
35mod build;
36mod catalog;
37mod codec;
38mod device;
39mod execution;
40mod fact;
41mod graph;
42mod host;
43mod keeper;
44mod key;
45mod memory;
46mod node;
47mod packing;
48mod placement;
49mod plan;
50mod transport;
51mod value;
52mod watcher;
53
54pub use build::{Wire, node};
55pub use catalog::Catalog;
56pub use codec::{
57 Codec, CodecError, anything_written, as_written, packed_all, unpacked_all, written_down,
58};
59pub use device::{Device, DeviceError};
60pub use execution::{Executor, FINGERPRINT, INPUT, NODE, OURS, RunError};
61pub use fact::Fact;
62pub use graph::{Edge, Graph, GraphError, NodeId};
63pub use host::Host;
64pub use keeper::{Keeper, KeeperError, Kept};
65pub use key::{Key, Keys};
66pub use memory::{Memory, MemoryError, cacheable};
67pub use node::{Ctx, Node, NodeError};
68pub use packing::Packing;
69pub use placement::Placement;
70pub use plan::{CompileError, Destination, Plan, Step, compile, distribute};
71pub use transport::{Cargo, Outcome, Transport, TransportError};
72pub use value::Value;
73pub use watcher::Watcher;