Am 04.10.2008 um 16:07 schrieb Marc Mims:

* Moritz Onken <[EMAIL PROTECTED]> [081004 06:10]:
You can SHA each column of the primary key and then SHA the joined SHAs.

SHA(SHA(A).SHA(B)) != SHA(AB);

Perfect!  Thanks.

Hi Marc,

I had a quick glance at your code and have some questions because I'm
interested in using it.

What happens if someone changes the primary key? This is likely if you
don't use auto_increment but characters. I guess the file cannot be found
because the SHA changed.

Why didn't you store a random SHA-string in the file column and name the
file using this string? This way the filename will not change if you change
the primary key.

There is another argument for doing so. If you update the file the filename will not change if the primary key(s) stays the same. A browser which caches the file will not try to fetch the file again, because the filename didn't
change. If you would create a new random filename each time the file is
updated you won't have such a problem.

Another thing which came to my mind is that you create a subdirecty of the
two first characters of the sha string. This makes 256 subdirectories
(for SHA-hex).
But if there are hundreds of thousands files it makes still a few thousands
per directory. I'd prefer a config option where I can set the depth of
the directory tree. Or I could overwrite _fs_column_storage myself :-)

I hope you understand what I'm worried about :-)

greets,

moritz

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to