vfs: add vfs.mounted() - #66116
vfs: add vfs.mounted()#66116pipobscure wants to merge 1 commit into
Conversation
There was no way to find out which virtual file systems are mounted. That matters most for mounts a program did not make itself: those created by --vfs-mount and --vfs-load at startup, and the assets of a single executable application. Add vfs.mounted(), which returns the VirtualFileSystem instances currently mounted in the calling thread, in the order they were mounted. A new array is returned on each call, so mutating it does not affect the mounts. Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
|
(Moving the conversation from the other thread) I really don't like that these aren't named. There's plenty of ways to handle duplicate names, the most obvious being to simply abort, or to define some precedence order (last-wins, except that NODE_OPTIONS always takes precedent over CLI, say). Naming programmatically created volumes is also easy; you just programmatically create names. But iterating over every mount poking at the contents to see if they're what you want is not very appealing. Nor is having to maintain a mapping between the order in which the |
|
What would you think about this: In the VFS Provider creation you have the optional specifying of a This would be fairly easy to retrofit and still maintain all the characteristics I care about as well. If that's something that you'd be on board with, I'd be happy to add that as a new PR. (This one wouldn't really be affected) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66116 +/- ##
=======================================
Coverage 90.27% 90.27%
=======================================
Files 790 790
Lines 271651 271667 +16
Branches 51842 51849 +7
=======================================
+ Hits 245228 245243 +15
+ Misses 16928 16925 -3
- Partials 9495 9499 +4
🚀 New features to boost your workflow:
|
There was no way to find out which virtual file systems are mounted. That matters most for mounts a program did not make itself: those created by --vfs-mount and --vfs-load at startup, and the assets of a single executable application.
Add vfs.mounted(), which returns the VirtualFileSystem instances currently mounted in the calling thread, in the order they were mounted. A new array is returned on each call, so mutating it does not affect the mounts.