[sugar] simple datastore replacement, take two
Benjamin M. Schwartz
Tue Sep 23 14:58:49 EDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Tomeu Vizoso wrote:
| 2.- all metadata properties are just strings.
I think this is a good decision (especially since by strings you mean
"byte arrays"). However, it's not quite true. Your design actually has
two classes of metadata properties: strings in "metadata" and files in
I like this design, but I think we can make it both simpler and more
powerful. Consider, for example, using a single djb-style database.
Each item is stored in a file whose name is the key, and whose contents
are the value. The Datastore can then provide two accessor functions:
get_by_value(key) and get_by_reference(key). get_by_value() returns the
contents of the file as a bytestring in memory. get_by_reference()
returns the path to the metadata file, or another path linked (soft or
hard) to that file. This provides all the needed functionality for large
and small metadata entries.
If the API requires file-like and string-like metadata to be completely
distinct, for example to create a dict for the string-like metadata, then
we can achieve this by using two such databases:
I hope that these designs may allow your datastore to become even simpler.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the Sugar-devel