kaish_kernel/vfs/mod.rs
1//! Virtual Filesystem (VFS) for kaish.
2//!
3//! The VFS provides a unified interface over multiple filesystem backends:
4//!
5//! - **MemoryFs**: In-memory ephemeral storage (for `/v`, tests)
6//! - **LocalFs**: Real filesystem access (for mounted worktrees)
7//! - **VfsRouter**: Routes paths to mounted backends
8//!
9//! # Design
10//!
11//! Kaish kernels own `/` in their VFS. Backends are mounted at paths:
12//!
13//! ```text
14//! / # kernel root
15//! ├── /v/ # MemoryFs (blobs, jobs)
16//! ├── /mnt/project/ # LocalFs (worktree, rw)
17//! └── /mnt/reference/ # LocalFs (repo, ro)
18//! ```
19//!
20//! The router finds the longest matching mount point and delegates operations.
21
22mod builtin_fs;
23mod jobfs;
24mod memory;
25mod router;
26
27pub use builtin_fs::BuiltinFs;
28// GitVfs + git types live in the kaish-tools-git crate (keeps libgit2 out
29// of the kernel). Re-exported so `crate::vfs::GitVfs` paths keep working.
30#[cfg(feature = "git")]
31pub use kaish_tools_git::{FileStatus, GitVfs, LogEntry, StatusSummary, WorktreeInfo};
32pub use jobfs::JobFs;
33pub use memory::MemoryFs;
34pub use router::{MountInfo, VfsRouter};
35
36// The `Filesystem` trait + `LocalFs` moved to the leaf `kaish-vfs` crate so
37// out-of-tree backends (notably `GitVfs`, which wraps a `LocalFs` worktree)
38// can implement the trait without depending on the kernel. Re-exported here so
39// existing `crate::vfs::{Filesystem, DirEntry, LocalFs}` paths keep working.
40pub use kaish_vfs::{DirEntry, DirEntryKind, Filesystem};
41#[cfg(feature = "localfs")]
42pub use kaish_vfs::LocalFs;