Trash spec: directory size cache

Diggory Hardy lists at dhardy.name
Wed Apr 24 05:25:03 PDT 2013


> > 
> > <P>Implementations MUST use a temporary file followed by an atomic
> > rename()
> > operation in order to avoid corruption due to two implementations writing
> > to the file at the same time. The fact that the changes from one of the
> > writers could get lost isn't an issue, the cache can be updated again
> > later on to add that entry.</P>
> 
> The cache can be updated again later.
> How, when, and who should do the update?
> If multiple file manager implementations are updating the file at the
> same time, only one of their change will be kept.
> How can we know there are directories missing from the cache?
> Should implementation enumerate the whole trash dir everytime to see
> is there any one missing from the cache? If that's the case, the
> implementation needs to calculate the total size of the missing
> folders, and add them to the cache.
> In the current proposal, we need to check frequently if there are dirs
> not included in the cache and fix the errors. This looks odds.
> Would you please clarify this part?
> Thank you.

I for one thought the spec was clear enough. Suggest rewording:

> Note that if the cache is recalculated by two processes simultaneously, one 
of the updates will be lost; this is not considered an issue since from the 
perspective of either of the updating processes the value obtained was correct 
at some point in their executation and from the point of view of a future 
process reading the cache, the worst case is that the cache read is a little 
older than the value last calculated.


More information about the xdg mailing list