Skip to main content

Crate cognis_graph

Crate cognis_graph 

Source
Expand description

§cognis-graph

v2-beta graph engine: typed Graph<S> + Pregel superstep executor. CompiledGraph<S> implements cognis_core::Runnable<S, S>.

Re-exports§

pub use analysis::GraphAnalysis;
pub use audit::AuditEntry;
pub use audit::AuditKind;
pub use audit::AuditLog;
pub use audit::AuditLogObserver;
pub use audit::InMemoryAuditLog;
pub use barrier::BarrierNode;
pub use builder::Graph;
pub use builder::LinearBuilder;
pub use channels::AnyValue;
pub use channels::BinaryOp;
pub use channels::Broadcast;
pub use channels::Channel;
pub use channels::ChannelRef;
pub use channels::CustomChannel;
pub use channels::Topic;
pub use channels::Untracked;
pub use checkpoint::ActiveSnapshot;
pub use checkpoint::Checkpointer;
pub use checkpoint::InMemoryCheckpointer;
pub use command::Command;
pub use compiled::CompiledGraph;
pub use durability::Durability;
pub use durability::DurabilityDecision;
pub use durability::DurabilityHook;
pub use goto::Goto;
pub use metrics::GraphMetrics;
pub use metrics::MetricsObserver;
pub use metrics::NodeTiming;
pub use metrics::ProfilingObserver;
pub use metrics::ThresholdCallback;
pub use metrics::ThresholdProfiler;
pub use node::node_fn;
pub use node::Node;
pub use node::NodeCtx;
pub use node::NodeFn;
pub use node::NodeOut;
pub use node::NodeRetryPolicy;
pub use reducer::Add;
pub use reducer::Append;
pub use reducer::Custom;
pub use reducer::LastValue;
pub use reducer::Merge;
pub use reducer::Reducer;
pub use snapshot::GraphSnapshot;
pub use state::GraphState;
pub use stream_mode::StreamMode;
pub use stream_mode::StreamModes;
pub use subgraph::Subgraph;
pub use cognis_core;
pub use cognis_core::schemars;

Modules§

analysis
Static graph analysis — cycle detection, longest path, reachability.
audit
Structured audit trail of graph node transitions.
barrier
Named barrier — wait for N parties before dispatching a target node.
builder
Graph builder — fluent API for constructing a graph.
channels
Channel value types — embeddable inside a crate::state::GraphState struct to express V1-style channel semantics on top of V2’s typed state model.
checkpoint
Checkpointing — persist graph state across supersteps for resume, time-travel, and human-in-the-loop interrupts.
command
Command<S> — fluent node return type bundling update + goto + payload.
compiled
Compiled, executable graph. Implements Runnable<S, S> so a graph composes anywhere a Runnable is expected (including as a node inside another graph).
durability
Compile-time setting controlling when checkpoints are persisted relative to a superstep’s execution.
goto
Goto — where the engine routes after a node finishes.
metrics
Per-node counters + simple timing aggregation as Observers.
node
Node trait + per-superstep context + helper closure adapter.
reducer
Channel reducers — strategies for merging per-step updates into state.
snapshot
Compiled-graph snapshot — the shape of a graph (not its node closures).
state
Per-graph typed state contract.
stream_mode
Granular streaming modes for CompiledGraph.
subgraph
Run a child graph as a node inside a parent graph, with state mapping in both directions.
viz
Render compiled graphs as Mermaid, GraphViz DOT, or ASCII diagrams for docs / debugging.

Derive Macros§

GraphState
Derive macro — generates impl GraphState for <T> with per-field reducers. The derive name shadows the trait name; both are imported via use cognis_graph::GraphState; because Rust allows a trait and a derive macro to share the same identifier (they live in different namespaces). #[derive(GraphStateV2)] — v2-shape state derive that emits a typed sibling <Name>Update struct and an impl GraphState for <Name>. Use in v2 code via the re-export cognis_core::GraphState (the rename happens in cognis-core’s lib.rs in Plan #2).