Lloyd Bryant wrote: > Is there any advantage to keeping the indices stable? SHA1 calculation > we've already looked at. The search table is rebuilt on each rescan, as is > the hash table. If there's anything in the system that depends on those > indices being stable after a rescan, then the whole sorting idea is in deep > trouble.....
No, it's nothing crucial. However, if the SHA-1 isn't available yet, the only unique key is the filename plus the index. Albeit I'm not certain that Gtk-Gnutella actually handles multiple files with the same name correctly in this case. That's easy to verify though. The idea behind the /get/<index>/<filename> scheme is to allow multiple files with the same name. At least I think so. I know that qsort() isn't stable which could be fixed by using a secondary key but I would guess that the same implementation would always gain the same order for the same input. Sure, if you add new files, this could cause a difference. I'd say for common use such problems are sufficiently unlikely and without exposing the full pathname, we can't really prevent such clashes before we know a checksum. Okay, we could store the index in the cache and then persist it. Note that the sha1_cache as it is, doesn't really use an extensible format. If we wanted to revise it, we'd probably have to rename it to prevent trouble if someone downgrades Gtk-Gnutella. On an unrelated note, it would certainly be preferable if we used the same format for all state/configuration files. However, XML sucks. A Lisp(-like) syntax has been considered before as it's extensible like XML but much more straight-forward with a minimum overhead and virtually no bloat. Sure, tons of braces look somewhat ugly, however, most data wouldn't use deeply nested structures but be flat as it's currently, so it should be just as readable. For example, the necessity for escaping was overseen which means we must avoid filenames with line-breaks in them. If someone knew of such a simple parser/generator available under a compatible license that would be great. -- Christian ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Gtk-gnutella-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel
