Added prefetch

This commit is contained in:
2026-03-13 18:23:26 +00:00
parent 9c55dce5a1
commit ec4bbd2c8c
3 changed files with 66 additions and 19 deletions

View File

@@ -139,6 +139,11 @@ impl<V: VirtualFileSystem> RemoteFileSystem for RemoteFileSystemImpl<V> {
let virt_path = sanitized_to_virt(&safe_path);
let entries = self.tree.get_snapshot(&virt_path, req.depth).await;
let total_entries: usize = entries.iter().map(|(_, v)| v.len()).sum();
tracing::debug!(
"GetSnapshot: path='{}' depth={} → {} dirs, {} total entries",
virt_path, req.depth, entries.len(), total_entries
);
let stream = async_stream::try_stream! {
for (path, children) in entries {

View File

@@ -34,11 +34,15 @@ impl WatchedTree {
let (change_tx, _) = broadcast::channel(BROADCAST_CAPACITY);
// Build snapshot, collect the absolute paths that were walked so we can watch them.
info!("WatchedTree: walking '{}' (depth {})…", root.display(), INITIAL_DEPTH);
let t = std::time::Instant::now();
let watched_dirs = walk_tree(&root, INITIAL_DEPTH, &snapshot).await;
let snap_len = snapshot.read().await.len();
info!(
"WatchedTree: snapshot ready ({} directories, {} inotify watches)",
snapshot.read().await.len(),
"WatchedTree: snapshot ready {} directories, {} inotify watches, took {:.1}s",
snap_len,
watched_dirs.len(),
t.elapsed().as_secs_f32(),
);
// Bridge notify's sync callback → async tokio task.