pub enum TreeCompareResult {
Equal,
Different {
remote_only_children: Vec<[u8; 32]>,
local_only_children: Vec<[u8; 32]>,
common_children: Vec<[u8; 32]>,
},
LocalMissing,
RemoteMissing,
}Expand description
Result of comparing two tree nodes.
Used for Merkle tree traversal during HashComparison sync. Identifies which children need further traversal in both directions.
Note: Borsh derives are included for consistency with other sync types and potential future use in batched comparison responses over the wire.
Variants§
Equal
Hashes match - no sync needed for this subtree.
Different
Hashes differ - need to recurse or fetch leaf.
For internal nodes: lists children to recurse into. For leaf nodes: all vecs will be empty, but Different still indicates that the leaf data needs to be fetched and merged bidirectionally.
Fields
LocalMissing
Local node missing - need to fetch from remote.
RemoteMissing
Remote node missing - local has data that remote doesn’t. For bidirectional sync, this means we may need to push to remote.
Implementations§
Source§impl TreeCompareResult
impl TreeCompareResult
Sourcepub fn needs_sync(&self) -> bool
pub fn needs_sync(&self) -> bool
Check if sync (pull from remote) is needed.
Returns true if local needs data from remote.
Sourcepub fn needs_push(&self) -> bool
pub fn needs_push(&self) -> bool
Check if push (send to remote) is needed for bidirectional sync.
Returns true if local has data that remote doesn’t:
RemoteMissing: entire local subtree needs pushingDifferentwithlocal_only_children: those children need pushingDifferentwith all empty vecs: this is a leaf node comparison where hashes differ, meaning local leaf data needs pushing for CRDT merge
Trait Implementations§
Source§impl BorshDeserialize for TreeCompareResult
impl BorshDeserialize for TreeCompareResult
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for TreeCompareResult
impl BorshSerialize for TreeCompareResult
Source§impl Clone for TreeCompareResult
impl Clone for TreeCompareResult
Source§fn clone(&self) -> TreeCompareResult
fn clone(&self) -> TreeCompareResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TreeCompareResult
impl Debug for TreeCompareResult
Source§impl EnumExt for TreeCompareResult
impl EnumExt for TreeCompareResult
Source§impl PartialEq for TreeCompareResult
impl PartialEq for TreeCompareResult
impl StructuralPartialEq for TreeCompareResult
Auto Trait Implementations§
impl Freeze for TreeCompareResult
impl RefUnwindSafe for TreeCompareResult
impl Send for TreeCompareResult
impl Sync for TreeCompareResult
impl Unpin for TreeCompareResult
impl UnsafeUnpin for TreeCompareResult
impl UnwindSafe for TreeCompareResult
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more