Even though looking up the proper size of a directory seems broken at the moment (#272), it should be possible and as it should be possible. One way of how I could see this work is by storing the size of all parent nodes inside the stats of a new add/delete file entry:
e.g. you add, foo/bar/baz with a size of 5 to an empty store:
a = { parentSize: [5, 5, 5] }
then you add foo/boz with a size of 7, it reads the last entry of foo which is above entry and adds to the hierarchy its shared the size:
b = { parentSize: [12, 12] }
when we look now for the last item in foo/bar it will return the first item with size 5 and on foo it should return 12. next: when the file foo/bar/buz with size 9 is created it will look into the last file of each parent folder foo and foo/bar and get the size for each, store it each as
an optimization step could be added that first looks at the last addition to the longest path foo/bar and compare it to the last entry of the root /, as soon as those happen to be the same, it stops iterating and uses that as base.
With the parentSize added to the folders we could simply list the sizes of folders, no many how many subdirectories there are, just by looking at the last entry.
Even though looking up the proper size of a directory seems broken at the moment (#272), it should be possible and as it should be possible. One way of how I could see this work is by storing the size of all parent nodes inside the stats of a new add/delete file entry:
e.g. you
add
,foo/bar/baz
with a size of 5 to an empty store:then you add
foo/boz
with a size of 7, it reads the last entry offoo
which is above entry and adds to the hierarchy its shared the size:when we look now for the last item in
foo/bar
it will return the first item with size5
and onfoo
it should return12
. next: when the filefoo/bar/buz
with size 9 is created it will look into the last file of each parent folderfoo
andfoo/bar
and get the size for each, store it each asor
And with the deletion of the first
foo/bar/baz
, a new "latest" entry is written, containing the new parent Sizes:or
With the parentSize added to the folders we could simply list the sizes of folders, no many how many subdirectories there are, just by looking at the last entry.