pub struct Commit {Show 15 fields
pub change_id: ChangeId,
pub parents: Vec<Cid>,
pub nodes: Cid,
pub edges: Cid,
pub schema: Cid,
pub delta: Option<Cid>,
pub indexes: Option<Cid>,
pub embeddings: Option<Cid>,
pub author: String,
pub agent_id: Option<String>,
pub task_id: Option<String>,
pub time: u64,
pub message: String,
pub signature: Option<Signature>,
pub extra: BTreeMap<String, Ipld>,
}Expand description
A versioned snapshot of the graph.
Fields§
§change_id: ChangeIdStable change identity (survives rewrite / rebase / amend).
parents: Vec<Cid>Parent commits (empty = root, ≥2 = merge).
nodes: CidRoot of the node Prolly tree.
edges: CidRoot of the edge Prolly tree.
schema: CidRoot of the schema Prolly tree.
delta: Option<Cid>Optional DeltaSet link (reserved; not emitted in mnem/0.1).
indexes: Option<Cid>Optional secondary-index root (crate::objects::IndexSet,
SPEC §4.8). Agents that only need Prolly-lookup by stable id
can ignore this; query paths (label / property / adjacency)
use it when present.
embeddings: Option<Cid>Optional embedding-sidecar Prolly root. Tree keyed by 32-byte
NodeCid digest, value = crate::objects::EmbeddingBucket.
Lifts dense embedding vectors out of Node canonical bytes so
the Node CID stays byte-stable across ORT thread counts (f32
reduction ordering is non-deterministic; vectors drift by the
LSB across thread counts). None on commits that carry no
embed-bearing nodes.
Intentionally excluded from content_cid. Content CID is
the deterministic “what graph is this” digest; including the
embeddings root would re-couple it to ORT thread count and
undo the determinism guarantee. Two machines re-deriving the
same source text on different cores produce the same
content_cid, just with per-machine drift in
commit.embeddings.
Free-form author identifier.
agent_id: Option<String>AI agent identifier (when the commit was machine-generated).
task_id: Option<String>Task / tool-call identifier for provenance.
time: u64Microseconds since Unix epoch.
message: StringUTF-8 commit message. May be empty.
signature: Option<Signature>Optional cryptographic signature.
extra: BTreeMap<String, Ipld>Forward-compat extension map (SPEC §3.2).
Implementations§
Source§impl Commit
impl Commit
Sourcepub fn new(
change_id: ChangeId,
nodes: Cid,
edges: Cid,
schema: Cid,
author: impl Into<String>,
time: u64,
message: impl Into<String>,
) -> Self
pub fn new( change_id: ChangeId, nodes: Cid, edges: Cid, schema: Cid, author: impl Into<String>, time: u64, message: impl Into<String>, ) -> Self
Build a commit with the required fields, empty optionals / parents / extras.
Sourcepub fn with_parent(self, parent: Cid) -> Self
pub fn with_parent(self, parent: Cid) -> Self
Append a parent commit. Returns self for chaining.
Sourcepub fn with_agent(self, agent_id: impl Into<String>) -> Self
pub fn with_agent(self, agent_id: impl Into<String>) -> Self
Attach an agent identifier.
Sourcepub fn content_cid(&self) -> Result<Cid, CodecError>
pub fn content_cid(&self) -> Result<Cid, CodecError>
(partial): a deterministic CID over only the data-DAG portion of the commit – the three Prolly tree roots (nodes, edges, schema), the optional indexes root, and the parents list. Excludes time, change_id, author, message, agent_id, task_id, signature, and extra.
Two ingest runs against byte-identical input on different
machines (or at different times) MUST produce the same
content_cid. The standard commit_cid continues to embed
wall-clock + UUIDv7 metadata for audit-trail purposes; that
CID is intentionally time-varying.
§Errors
Propagates encoding failures from
crate::codec::dagcbor::hash_to_cid.
§Migration note
Wire format is unchanged: content_cid is computed from
existing fields, so older blockstores stay readable. A
follow-up may persist content_cid alongside commit_cid in
the operation log for cheap lookup.