Skip to content

feat(vfs): lazy file content loading for InMemoryFs#923

Merged
chaliy merged 3 commits intomainfrom
feat/issue-912-lazy-vfs
Mar 31, 2026
Merged

feat(vfs): lazy file content loading for InMemoryFs#923
chaliy merged 3 commits intomainfrom
feat/issue-912-lazy-vfs

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 31, 2026

Summary

  • Adds LazyFile variant to FsEntry — defers content loading until first read_file()
  • stat() returns metadata without triggering the load
  • If written before read, the loader is never called
  • snapshot() materializes all lazy files before capturing
  • New public API: InMemoryFs::add_lazy_file() and BashBuilder::mount_lazy()

Test plan

  • test_lazy_file_read — stat doesn't load, read does
  • test_lazy_file_write_before_read_skips_loader — write replaces lazy entry
  • test_lazy_file_exists_and_readdir — lazy files appear in listings
  • test_lazy_file_snapshot_materializes — snapshot forces load
  • Clippy clean, all existing tests pass

Closes #912

chaliy added 3 commits March 31, 2026 18:56
Add LazyFile variant to FsEntry that defers content loading until first
read. stat() returns metadata without triggering the load. If a lazy
file is overwritten before being read, the loader is never called.

Adds add_lazy_file() on InMemoryFs and mount_lazy() on BashBuilder.
Includes 4 unit tests covering read, write-before-read, exists/readdir,
and snapshot materialization.

Closes #912
@chaliy chaliy merged commit c2ed90c into main Mar 31, 2026
27 checks passed
@chaliy chaliy deleted the feat/issue-912-lazy-vfs branch March 31, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(vfs): lazy file content loading for InMemoryFs

1 participant