pub struct PathMerkle;Expand description
Manages path-based Merkle tree operations.
This is the local computation layer - storage is handled by RedisMerkleStore.
Implementations§
Source§impl PathMerkle
impl PathMerkle
Sourcepub fn split_path(object_id: &str) -> Vec<&str>
pub fn split_path(object_id: &str) -> Vec<&str>
Split an object_id into path segments.
uk.nhs.patient.record.123 -> ["uk", "nhs", "patient", "record", "123"]
Sourcepub fn parent_prefix(path: &str) -> &str
pub fn parent_prefix(path: &str) -> &str
Get the parent prefix for a path.
uk.nhs.patient.record.123 -> uk.nhs.patient.record
uk -> "" (root)
Sourcepub fn ancestor_prefixes(path: &str) -> Vec<String>
pub fn ancestor_prefixes(path: &str) -> Vec<String>
Get all ancestor prefixes for a path (excluding root, including self).
uk.nhs.patient -> ["uk", "uk.nhs", "uk.nhs.patient"]
Sourcepub fn leaf_hash(
object_id: &str,
version: u64,
payload_hash: &[u8; 32],
) -> [u8; 32]
pub fn leaf_hash( object_id: &str, version: u64, payload_hash: &[u8; 32], ) -> [u8; 32]
Compute the leaf hash for a sync item.
Hash = SHA256(object_id || version || payload_hash)
Note: We intentionally exclude timestamp to ensure idempotent updates. Two writes with identical content should produce the same Merkle root, regardless of when they occurred. This prevents false sync conflicts.
Sourcepub fn payload_hash(payload: &[u8]) -> [u8; 32]
pub fn payload_hash(payload: &[u8]) -> [u8; 32]
Compute hash of a payload (for leaf_hash input).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PathMerkle
impl RefUnwindSafe for PathMerkle
impl Send for PathMerkle
impl Sync for PathMerkle
impl Unpin for PathMerkle
impl UnwindSafe for PathMerkle
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> 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