Expand description
§Copia
Pure Rust rsync-style synchronization for Sovereign AI.
Copia implements the rsync delta-transfer algorithm in 100% safe Rust, providing memory-safe, auditable, high-performance file synchronization.
§Features
- Rolling Checksum: Adler-32 variant for O(1) window sliding
- Strong Hash: BLAKE3 for cryptographic block verification
- Delta Encoding: Efficient representation of file differences
- Streaming: O(1) memory for arbitrary file sizes
§Example
use copia::{SyncBuilder, Sync};
use std::io::Cursor;
// Create sync engine with custom block size
let sync = SyncBuilder::new()
.block_size(2048)
.build();
// Generate signature from basis file
let basis = b"original file content";
let signature = sync.signature(Cursor::new(basis.as_slice())).unwrap();
// Compute delta from modified source
let source = b"modified file content";
let delta = sync.delta(Cursor::new(source.as_slice()), &signature).unwrap();
// Apply delta to reconstruct
let mut output = Vec::new();
sync.patch(Cursor::new(basis.as_slice()), &delta, &mut output).unwrap();
assert_eq!(output, source);Modules§
- async_
sync - Async synchronization operations using tokio.
Structs§
- Block
Signature - Signature for a single block in the basis file.
- Codec
- Protocol codec for reading/writing framed messages.
- Copia
Sync - Main synchronization engine implementing the rsync algorithm.
- Delta
- Encoded delta representing the difference between source and basis files.
- Delta
Stats - Statistics from delta computation.
- Fast
Rolling Checksum - High-performance rolling checksum with lazy modulo operations.
- Frame
Builder - Frame builder for constructing protocol frames.
- Frame
Header - Protocol frame header.
- Rolling
Checksum - Rolling checksum state for incremental computation.
- Signature
- Complete signature of a basis file.
- Signature
Table - Efficient lookup table for block matching.
- Strong
Hash - Strong cryptographic hash for block verification.
- Sync
Builder - Builder for creating sync engines with custom configuration.
- Sync
Config - Configuration for sync operations.
- Sync
Stats - Statistics from a sync operation.
Enums§
- Copia
Error - Errors that can occur during copia operations.
- DeltaOp
- Delta instruction types.
- Message
- Protocol messages.
- Message
Type - Protocol message types.
Constants§
- PROTOCOL_
MAGIC - Protocol magic bytes: “COPA”
- PROTOCOL_
VERSION - Current protocol version.
Traits§
- Sync
- Core synchronization operations trait.
Type Aliases§
- Result
- Result type for copia operations.