<div dir="ltr">Do the keys accept %? uri-encoding them would be the obvious solution here. I'm also very uncomfortable with the sha1 bit, but apart from that everything looks good.</div><div class="gmail_extra"><br clear="all">
<div>J. Leclanche</div>
<br><br><div class="gmail_quote">On Mon, Apr 15, 2013 at 9:11 AM, David Faure <span dir="ltr"><<a href="mailto:faure@kde.org" target="_blank">faure@kde.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Monday 15 April 2013 10:19:55 Bastien Nocera wrote:<br>
> Em Mon, 2013-04-15 às 10:07 +0200, Alexander Larsson escreveu:<br>
> > On sön, 2013-04-14 at 23:48 +0200, David Faure wrote:<br>
> > > To implement a maximum size for the trash directory, one needs to check<br>
> > > the<br>
> > > size every time a new item is being trashed. With the current spec, the<br>
> > > only solution is to do a recursive traversal, which is pretty<br>
> > > expensive. To make this efficient, we need a cache.<br>
> > > My initial idea of a global "total size" cache doesn't work well with<br>
> > > older<br>
> > > implementations which don't update that value, so it gets out of date<br>
> > > quickly.<br>
> > ><br>
> > > Instead, Ryan Lortie and I came up with the following idea, which we<br>
> > > would<br>
> > > like to standardize into the trash spec:<br>
> > ><br>
> > > For files, we get the file from stat. For dirs, we use a cache:<br>
> > > in every trash directory, a metadata file is created, with one entry per<br>
> > > directory (that was trashed by the user).<br>
> > > That entry contains the total size in bytes of the directory, and the<br>
> > > modification time of the trashinfo file [*].<br>
> > ><br>
> > > The metadata file uses desktop file syntax, where the key is the<br>
> > > directory<br>
> > > name, and the value is a pair: size, and mtime.<br>
> > ><br>
> > > However the desktop file standard restricts the available characters for<br>
> > > keys, so instead of just writing out the directory name, we write the<br>
> > > sha1 of the directory name (a bit like the thumbnail spec uses sha1s<br>
> > > too).<br>
> > ><br>
> > > In summary, it would look like this:<br>
> > ><br>
> > > [Directories]<br>
> > > # One entry per sub-directory of the "files" directory<br>
> > > # key = sha1 of the directory name<br>
> > > # value = size in bytes, timestamp of the trashinfo file, in UTC<br>
> > > cb58e5c11a6802db43fd82ca8d3c7393353c0eab=25383,2009-07-11T20:18:30<br>
> > > f1d2d2f924e986ac86fdf7b36c94bcdf32beec15=2315,2012-04-12T10:05:20<br>
> ><br>
> > In general this sounds good to me. I have two minor objections:<br>
> ><br>
> > 1: Using sha1 seems wrong to me. There is no need to get an even<br>
> > distribution of the keys (like for thumbnail subdirectories), and a sha1<br>
> > is slow to calculate. Also, if you ever look at the file manually its<br>
> > says very little. I would much prefer simple character escape model, say<br>
> > you allow A-Za-z0-9 and everyting else you escape as "-" + the hex<br>
> > digits (like "-2d" for "-"). This is valid desktop file keys, are cheap<br>
> > to calculate and makes most files readable by humans.<br>
><br>
> Or base-64 encode the directory name. Even if that fails the "readable<br>
> by humans" test, at least it'll avoid slightly differently buggy escape<br>
> sequences).<br>
<br>
</div></div>Base-64 leads to huge output. I think escaping with '-'+hex is fine (possibly<br>
faster, more readable, and not as big). I don't see the "buggy" argument.<br>
<div class="im HOEnZb"><br>
--<br>
David Faure, <a href="mailto:faure@kde.org">faure@kde.org</a>, <a href="http://www.davidfaure.fr" target="_blank">http://www.davidfaure.fr</a><br>
Working on KDE, in particular KDE Frameworks 5<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
xdg mailing list<br>
<a href="mailto:xdg@lists.freedesktop.org">xdg@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/xdg" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xdg</a><br>
</div></div></blockquote></div><br></div>