feat(vfs): in-memory virtual filesystem + state integration#371
Open
davydog187 wants to merge 1 commit into
Open
feat(vfs): in-memory virtual filesystem + state integration#371davydog187 wants to merge 1 commit into
davydog187 wants to merge 1 commit into
Conversation
Add Lua.VFS, a flat-map in-memory filesystem keyed by normalized absolute path, with tagged-tuple errors (:enoent/:eisdir/:einval) that map onto Lua's nil/message/errno io/os contract. Seed it on Lua.VM.State (new/0) and thread it through vfs_read/2, vfs_write/3, vfs_rm/2, vfs_exists?/2. Add update_userdata/3 for mutable userdata (forthcoming io file-handle cursors). Foundation for virtual-by-default execution; no behavior change yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Virtual-by-default, PR 1/4 — foundation
First slice of the 1.0.0 virtual-by-default work (tracking: #297; supersedes the draft #302). No behavior change — this only adds the storage layer the later PRs route through.
What
Lua.VFS— a vendored, in-memory virtual filesystem: a flat map keyed by normalized absolute path, directories implicit, with tagged-tuple errors (:enoent/:eisdir/:einval) that map onto Lua'snil, message, errnoio/os contract. No external dependency (keeps the Elixir floor at~> 1.16andmix hex.publishclean — unlike feat(stdlib): route os/require file IO through a virtual filesystem #302'sivarvong/vfsgit dep).Lua.VM.State—vfsfield seeded innew/0; threaded helpersvfs_read/2,vfs_write/3,vfs_rm/2,vfs_exists?/2; plusupdate_userdata/3for the mutable file-handle cursors coming in the io PR.Why this shape
A git dependency blocks
mix hex.publishand bumps the Elixir floor; the surface actually needed is tiny (read/write/rm/exists over one in-memory tree), so it's vendored in-tree where the security boundary belongs.Next in the stack
sandbox:/env:API + Os.Common/Virtual/Host split + virtual/host loaders (removes the per-path deny-list)io.*virtualization over the VFSVerification
mix test: 2588 passed (+24 new), 0 failuresmix format+mix compile --warnings-as-errors: clean