Skip to main content

Crate khive_changeset

Crate khive_changeset 

Source
Expand description

KG change-set op-list model and NDJSON-delta codec.

See crates/khive-changeset/docs/api/ndjson-codec.md for the wire format.

Structs§

ChangeSet
Envelope metadata plus an ordered list of staged operations.
CreateOp
Creates an entity or note with an ID minted and stabilized at stage time.
CurrentState
Live records read by the caller when staging a revert.
DeleteOp
Removes one record with its required, full stage-time preimage.
EdgePatch
Edge fields to mutate; weight must be finite and in [0.0, 1.0].
EdgePreimage
Prior edge values for exactly the fields touched by EdgePatch.
EntityCreateFields
Fields staged for a new entity.
EntityPatch
Entity fields to mutate; absent means unchanged and Some(None) clears a nullable field (ADR-014 tri-state, applied to description and entity_type).
EntityPreimage
Prior entity values for exactly the fields touched by EntityPatch.
Envelope
Change-set-wide producer identity and stage-time provenance.
LinkOp
Creates a directed edge whose ID is minted at stage time.
MergeOp
Merges two entities with required participant and incident-edge preimages.
MergePreimage
Full prior state required to validate and rewire an entity merge.
NoteCreateFields
Fields staged for a new note.
NotePatch
Note fields to mutate; nested options distinguish unchanged, clear, and set.
NotePreimage
Prior note values for exactly the fields touched by NotePatch.
PreimageMismatch
A stable field path without captured or current record contents.
UpdateOp
Patches one record with a stage-time preimage of exactly the touched fields.

Enums§

CanonicalRecordRef
A caller-supplied record from the applying transaction, without a storage handle.
ChangeSetError
In-memory NDJSON encode/decode errors; no variant represents I/O.
CreateTarget
Substrate-specific create fields, tagged by kind.
DeletePreimage
Full prior record state, tagged by substrate to avoid its embedded kind field.
InvertError
A refusal to stage an inverse; no partially inverted change-set is returned.
Op
One staged mutation, internally tagged by the snake-case op field.
UpdatePatch
Substrate-specific patch tagged by target.
UpdatePreimage
Field-scoped preimage tagged with the same target as UpdatePatch.

Constants§

CURRENT_SCHEMA_VERSION
The NDJSON-delta schema version this crate currently emits and accepts.

Functions§

check_delete
The captured record is exact except for its applier-stamped updated_at.
check_update
The caller must read live inside the same transaction that applies op.
from_ndjson
Decodes an envelope header and every following line as one ordered Op.
to_ndjson
Encodes the envelope as line one and each op on a following line, in order.