xoofx / zio

A cross-platform abstract/virtual filesystem framework with many built-ins filesystems for .NET
BSD 2-Clause "Simplified" License
817 stars 61 forks source link

Properly show mount paths when enumerating MountFS (fixes #28) #29

Closed Rohansi closed 6 years ago

Rohansi commented 6 years ago

Also make DirectoryExists return true when the path is part of a mount name, which allows the use of DirectoryEntry on those paths.

Rohansi commented 6 years ago

Alright, I made it like AggregateFileSystem where it grabs a copy only once so it wont lock for long.

Rohansi commented 6 years ago

Actually, the behavior here might be a bit off with regards to NextFileSystem. For MountFileSystem we want it to only be used when a mount is not matched. How should this work?

If I mount a filesystem to /x/y and the next filesystem also has /x will listing /x show both? But if both have /x/y it will only show the mount's copy?

xoofx commented 6 years ago

Actually, the behavior here might be a bit off with regards to NextFileSystem. For MountFileSystem we want it to only be used when a mount is not matched. How should this work?

Yeah, that's why it was a single directory at the beginning... 😅 but it was indeed making mount points less interesting.

Ideally, it should work like aggregate on these. A mount point is merged on top of what the NextFileSystem provides.

If I mount a filesystem to /x/y and the next filesystem also has /x will listing /x show both? But if both have /x/y it will only show the mount's copy?

So it should be yes and yes.

Rohansi commented 6 years ago

Alright so the other methods need to be updated to behave like that as well. Right now they just look for whichever mount name is the best match and forwards to that filesystem, but I changed enumerate here to merge them like aggregate does.

So how should writing work? Should new files be created in whichever filesystem is the best match? Reading would just need to look around for the existing file.

Rohansi commented 6 years ago

I believe that's all now. Mount points essentially override paths in the NextFileSystem without any aggregating between the filesystems.