pub struct SyncSignature {
pub size: u64,
pub mtime_sec: i64,
pub mtime_nsec: i64,
pub hash: Option<String>,
pub merkle_root: Option<String>,
pub chunk_size: Option<u64>,
pub leaf_count: Option<u32>,
pub avg_entropy: Option<f32>,
pub entropy_class: Option<String>,
pub file_simhash: Option<i64>,
pub version: u8,
}Expand description
File sync signature stored in xattr/sidecar for change detection
Fields§
§size: u64File size in bytes
mtime_sec: i64Modification time (seconds since epoch)
mtime_nsec: i64Modification time nanosecond component
hash: Option<String>Hex-encoded BLAKE3 lite hash (head+tail sampling)
merkle_root: Option<String>Hex-encoded BLAKE3 full Merkle root
chunk_size: Option<u64>Chunk size used for Merkle tree construction
leaf_count: Option<u32>Number of Merkle leaves (v4+)
avg_entropy: Option<f32>Average Shannon entropy across all chunks (v5+, 0.0-8.0 bits/byte)
entropy_class: Option<String>Entropy classification label (v5+, e.g. “low”, “medium”, “high”, “encrypted”)
file_simhash: Option<i64>SimHash-64 whole-file fingerprint stored as i64 for pgvector BIGINT compat (v5+)
version: u8Signature schema version
Implementations§
Source§impl SyncSignature
impl SyncSignature
pub const CURRENT_VERSION: u8 = 5
Sourcepub fn compute(path: &Path) -> Result<Self>
pub fn compute(path: &Path) -> Result<Self>
Compute a sync signature from a file’s current metadata and content hashes
Sourcepub fn compute_from_buffer(data: &[u8], mtime_sec: i64, mtime_nsec: i64) -> Self
pub fn compute_from_buffer(data: &[u8], mtime_sec: i64, mtime_nsec: i64) -> Self
Compute a signature from an in-memory buffer. Used by the NFS compound bypass path where file data is already in memory.
Sourcepub fn deserialize(data: &[u8]) -> Option<Self>
pub fn deserialize(data: &[u8]) -> Option<Self>
Deserialize from bincode bytes (returns None on invalid data)
Sourcepub fn deserialize_versioned(data: &[u8]) -> Option<Self>
pub fn deserialize_versioned(data: &[u8]) -> Option<Self>
Version-aware deserialization. Handles v5 (current), v4 (missing entropy/simhash fields), v3 (missing leaf_count), and unknown/corrupt blobs (returns None with warn! log).
Sourcepub fn matches(&self, other: &Self) -> bool
pub fn matches(&self, other: &Self) -> bool
Check if two signatures represent the same file state (merkle_root takes priority over mtime)
Sourcepub fn hash_cid(&self) -> Option<String>
pub fn hash_cid(&self) -> Option<String>
Return the lite hash as a CID string (computed on demand from hex).
Sourcepub fn merkle_root_cid(&self) -> Option<String>
pub fn merkle_root_cid(&self) -> Option<String>
Return the Merkle root as a CID string (computed on demand from hex).
Trait Implementations§
Source§impl Clone for SyncSignature
impl Clone for SyncSignature
Source§fn clone(&self) -> SyncSignature
fn clone(&self) -> SyncSignature
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyncSignature
impl Debug for SyncSignature
Source§impl<'de> Deserialize<'de> for SyncSignature
impl<'de> Deserialize<'de> for SyncSignature
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SyncSignature
impl RefUnwindSafe for SyncSignature
impl Send for SyncSignature
impl Sync for SyncSignature
impl Unpin for SyncSignature
impl UnsafeUnpin for SyncSignature
impl UnwindSafe for SyncSignature
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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