Skip to main content

Crate corpora_core

Crate corpora_core 

Source
Expand description

Pure domain core: the schema as types, the immutable Graph, the event bus (Event, Subscriber, Context), and Diagnostic. No IO — see corpora-engine for the filesystem/git edges.

Re-exports§

pub use graph::Cite;
pub use graph::Graph;
pub use graph::Relation;
pub use oracle::NullOracle;
pub use oracle::OracleStatus;
pub use oracle::RevisionOracle;
pub use subscriber::Context;
pub use subscriber::Interest;
pub use subscriber::Subscriber;
pub use model::*;
pub use diagnostic::*;
pub use config::*;
pub use event::*;

Modules§

config
Run configuration, threaded through every Context.
diagnostic
Diagnostics are data, not panics — the corpus stays inspectable on any failure.
event
The event vocabulary the bus carries. Components communicate only through these.
graph
The immutable, queryable graph rules and adapters consume. build is pure: records -> (Graph, Vec<Diagnostic>), resolving supersession into three views — raw (declared edges), effective (adopted successor, chased to the terminal), and pending (a proposed/open replacement not yet adopted) — and flagging duplicate ids, kind mismatches, multiple adopted successors, and cycles.
model
The schema (schema-v0) as types: illegal states unrepresentable where cheap. Parsing produces a Record; a kind-specific Facet carries the rest.
oracle
The one impure dependency the rule pack needs: resolving VCS revisions. The trait lives in core so rules can depend on it; the git-backed implementation is in corpora-engine (it does IO). Inject a NullOracle in tests to keep rules pure-testable.
subscriber
The bus contract: every component is a Subscriber that reacts to Events and emits more through its Context. Interest is a cheap bitset prefilter.