Trash spec: caching the size of the trash directory

PCMan pcman.tw at gmail.com
Thu Aug 13 22:24:12 PDT 2009


If this is going to be supported, I'd suggest that we also move all of
the information in *.trashinfo files to this metadata file to reduce
excessive I/O, disk space waste, and performance penalty needed to
maintain the whole trash bin. In this way every time we changed
something in the trash bin, only one metadata file needs to be
updated.

A potential problem of your proposal is, it's not backward compatible.
A file trashed with an older file manager won't update this file. How
to solve this?

On Fri, Aug 14, 2009 at 4:17 AM, David Faure<faure at kde.org> wrote:
> In order to implement the long-requested feature "automatically remove
> the oldest (or biggest) items from the trash when it reaches a certain size",
> we have the problem of constantly having to determine the size of the trash
> (i.e. the size of the N trash directories).
>
> This is really easy to solve with a cache (the value written into a file)
> if we can agree to put that into the spec, so that all implementations of the
> trash spec update that cached size value.
>
> In order to keep that file out of the way of the info and files subdirs, I
> suggest to put it at the same level as those two, i.e. at the root of each
> trash directory.
>
> The file could be named "metadata" (generic name so that we can add
> more such info later), and I would suggest an INI format, much like
> the trash info files.
>
> [Cached]
> Size=130460
>
> (in bytes of course).
> The group name indicates clearly that this is a cache, i.e. if it's not there
> it can always be calculated the slow way -- but the goal is to not have
> to do the recursive directory listing before each trash operation, that's
> just too slow.
>
> And then it's up to implementations to update that value, when
> adding a file to the trash, restoring a trashed file, deleting a trashed file,
> and when emptying the trash.
>
> Is this OK with other implementors of the trash spec? Can it be added
> to the spec?
>
> --
> David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
> Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xdg
>


More information about the xdg mailing list