Skip to main content

ReplicationProtocol

Trait ReplicationProtocol 

Source
pub trait ReplicationProtocol {
    // Required methods
    fn merkle_root(&self) -> Result<[u8; 32], EdgestoreError>;
    fn list_segments(&self) -> Result<Vec<SegmentRef>, EdgestoreError>;
    fn fetch_segment(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>;
}
Expand description

Pull-only replication protocol trait (D02, D08).

Two nodes compare Merkle roots first (merkle_root); if equal, sync is skipped entirely. If roots differ, the caller fetches the peer’s full segment manifest (list_segments) and computes the set difference locally. Missing segments are fetched one at a time (fetch_segment). Caller MUST verify BLAKE3(data) == hash before applying (T-04-01).

The trait is object-safe: no generic parameters, no associated types.

Required Methods§

Source

fn merkle_root(&self) -> Result<[u8; 32], EdgestoreError>

Returns the peer’s current Merkle root for anti-entropy probe (D02).

Caller compares to local root; if equal, sync is skipped.

Source

fn list_segments(&self) -> Result<Vec<SegmentRef>, EdgestoreError>

Returns the peer’s full segment manifest as Vec<SegmentRef> (D02).

Called only when roots differ. Caller computes set diff locally.

Source

fn fetch_segment(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>

Downloads one segment by content hash (D01).

Caller MUST verify BLAKE3(data) == hash before applying (T-04-01).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§