pub struct Diff<'a> {
pub changes: &'a [Change<'a>],
}Expand description
What changed in a write, as the applicability index’s key.
The diff has to be computed to evaluate anything, so diffing is the indexing step: a write’s changed paths are walked through the tree once, and a write matching no policy has paid only for that walk.
The contract is exact: changes holds every path whose value differs
between before and after, where absence is a value — so a create lists
every path it introduces, a delete lists every path it removes, and
there is no case where an evaluator sees an empty diff for a write that
changed something. The server computes this, holding both sides of the
write already, so it is enforced once in the write path rather than
trusted from whatever produced the write.
This is a minimal, storage-agnostic view, deliberately not the richer
diff type that didbot-data’s merkle search tree produces. That type
carries proof material this crate has no use for, and coupling the
policy core to one storage engine’s diff shape would be a dependency in
the wrong direction.
Fields§
§changes: &'a [Change<'a>]Every path that changed, each with its value before and after.
Trait Implementations§
impl<'a> Copy for Diff<'a>
impl<'a> Eq for Diff<'a>
impl<'a> StructuralPartialEq for Diff<'a>
Auto Trait Implementations§
impl<'a> Freeze for Diff<'a>
impl<'a> RefUnwindSafe for Diff<'a>
impl<'a> Send for Diff<'a>
impl<'a> Sync for Diff<'a>
impl<'a> Unpin for Diff<'a>
impl<'a> UnsafeUnpin for Diff<'a>
impl<'a> UnwindSafe for Diff<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.