manuel-woelker / rust-vfs

A virtual filesystem for Rust
Apache License 2.0
384 stars 44 forks source link

OverlayFS: Get a layer by it's index #21

Closed BrettMayson closed 3 years ago

manuel-woelker commented 3 years ago

Hi, thanks for the PR! I'm trying to understand the use case. I am guessing this is somehow for getting the individual layers in order to determine in which layer a file actually lives. Is that correct?

BrettMayson commented 3 years ago

I am using an OverlayFS with a Memory and Physical as the two layers. I am doing a bunch of file processing that get written into the memory layer, a the end I want to write the final output to the physical layer.

manuel-woelker commented 3 years ago

Ah I see. I am a bit hesitant to add a method to the OverlayFS that indirectly allows mutating the lower filesystems again.

For the use case you described, since you would need to hold on to the OverlayFS anyway, would it be possible to retain the handles to the physical and memory layers explicitly, e.g. as a pair of FileSystem or VfsPath?