vfsStream icon indicating copy to clipboard operation
vfsStream copied to clipboard

Per directory Quota

Open VRciF opened this issue 12 years ago • 1 comments

In one of my projects i'm aggregating a few mount points together so i'm able to scale disk operations beyond one partition - e.g. switch to another mountpoint if primary disk is full. To test this i would create a directory structure which requires different quotas per virtual mount points.

With a bit guidance i could provide the code changes. My modification would be to add setQuota($quotainstance) and getQuota() to vfsStreamAbstractContent whereas getQuota recursively searches its parent paths for a quota instance. The method getQuota would then be used in vfsStreamWrapper methods stream_write and stream_truncate right before overall root-quota is used and setQuota would get used in newDirectory by adding a new quota parameter in bytes.

VRciF avatar Oct 30 '13 19:10 VRciF

This would be an interesting feature, but implementing it the way you suggest would make the internals really complicated. Currently instances of vfsStreamContent just know their parent path, but for good reason don't have a reference to their parent which I don't want to change. I also don't want them to access the root directory to get their parent from there - this would create a tight coupling between things that shouldn't be coupled at all.

Having said that, I think to enable this feature it would be a good idea to introduce the concept of partitions to vfsStream. Quotas can then be bound to partitions, and vfsStreamWrapper could work with partitions, whereas vfsStreamContent could stay decoupled from the whole quota concept. I didn't think this through completely, but I guess this would introduce some major backward incompatible changes, so it could be an idea for version 2.

mikey179 avatar Nov 01 '13 21:11 mikey179