pub struct Change {
pub path: Arc<str>,
pub old_value: OwnedDataValue,
pub new_value: OwnedDataValue,
pub removed: bool,
}Expand description
A single recorded mutation in the audit trail.
old_value and new_value are owned OwnedDataValues rather than
Arc<OwnedDataValue> — eliminates one heap allocation per Change on the
hot path. External consumers that need to share a Change across threads
can wrap it themselves; in-process pipelines (audit-on map mappings) don’t
pay the Arc cost they were never going to use.
A path that was absent before the write records old_value as null.
Fields§
§path: Arc<str>§old_value: OwnedDataValue§new_value: OwnedDataValueThe value written. null when Self::removed is set — read that
flag rather than this value to tell a removal from a write.
removed: boolThe key at path was removed rather than written — a map mapping
with unset, or on_null: "unset" meeting a null result. new_value
is then null, which alone could not tell “now absent” from “now
holds null”.
Skipped when false, so every write’s audit JSON is byte-identical to
what it was before removals existed, and a reader that predates the
field still loads a removal (as a write of null).