pub struct Operation {
pub parents: Vec<Cid>,
pub view: Cid,
pub predecessors: Option<BTreeMap<String, Vec<ChangeId>>>,
pub author: String,
pub agent_id: Option<String>,
pub task_id: Option<String>,
pub host: Option<String>,
pub time: u64,
pub description: String,
pub signature: Option<Signature>,
pub extra: BTreeMap<String, Ipld>,
}Expand description
A single mutation of repository state.
Fields§
§parents: Vec<Cid>Parent operations (the op-heads observed when this op started). 0 for the root op; ≥2 after a concurrent-write merge.
view: CidSnapshot of the post-mutation state. A Link<View>.
predecessors: Option<BTreeMap<String, Vec<ChangeId>>>For each rewritten commit, the ChangeIds of its predecessors.
Keys are UUID-string representations of ChangeIds (DAG-CBOR map
keys MUST be strings; SPEC §4.5).
Free-form author identifier.
agent_id: Option<String>AI-agent identifier (when machine-generated).
task_id: Option<String>Task / tool-call identifier for provenance.
host: Option<String>Host identifier.
time: u64Microseconds since Unix epoch.
description: StringShort human description (e.g. "commit: feat(auth): add OAuth").
signature: Option<Signature>Optional cryptographic signature (SPEC §9.1). Attached via
crate::sign::Signer::sign_operation; verified via
crate::sign::Verifier::verify_operation.
extra: BTreeMap<String, Ipld>Forward-compat extension map (SPEC §3.2).
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn new(
view: Cid,
author: impl Into<String>,
time: u64,
description: impl Into<String>,
) -> Self
pub fn new( view: Cid, author: impl Into<String>, time: u64, description: impl Into<String>, ) -> Self
Construct an operation with required fields and no parents / optionals.
Sourcepub fn with_parent(self, parent: Cid) -> Self
pub fn with_parent(self, parent: Cid) -> Self
Append a parent operation. 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.