Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/filesync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ crossbeam-channel = { workspace = true }
parking_lot = { workspace = true }
log = { workspace = true }
bincode = "1"
blake3 = "1"
blake3 = { version = "1", features = ["mmap", "rayon"] }
jwalk = "0.8"
num_cpus = "1"
lz4_flex = "0.11"
rayon = "1"
walkdir = "2"
Expand Down
15 changes: 4 additions & 11 deletions crates/filesync/src/bundler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,11 @@ fn stream_large_file(
);

let hash_start = std::time::Instant::now();
// Unified tiered digest (mmap for big files, streaming otherwise);
// the chunk protocol below is unchanged.
let final_hash: [u8; 32] = {
let mut hasher = blake3::Hasher::new();
let mut f = std::fs::File::open(&full)?;
let mut buf = vec![0u8; 64 * 1024];
loop {
let n = f.read(&mut buf)?;
if n == 0 {
break;
}
hasher.update(&buf[..n]);
}
hasher.finalize().into()
let (_, h) = crate::manifest::hash_file_tiered(&full)?;
h
};
debug!(
"bundler: large file {:?} hash computed in {}ms",
Expand Down
2 changes: 2 additions & 0 deletions crates/filesync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub mod gui;
pub mod known_hosts;
pub mod ledger;
pub mod manifest;
pub mod manifest_cache;
pub mod protocol;
pub mod server;
pub mod suspend_detector;
Expand All @@ -17,6 +18,7 @@ pub mod watcher;
pub use app::FileSyncApp;
pub use known_hosts::{ClientStatus, KnownClient, KnownClients, KnownServer, KnownServers};
pub use ledger::{DeletionLedger, Tombstone, DELETION_LEDGER_TTL_MS};
pub use manifest_cache::{CachedEntry, ManifestCache, CACHE_MIN_AGE_MS};

pub fn timestamp_id() -> u64 {
use std::time::{SystemTime, UNIX_EPOCH};
Expand Down
Loading
Loading