[sugar] simple datastore replacement, take two

Benjamin M. Schwartz bmschwar
Tue Sep 23 14:58:49 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
"extra_metadata".

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.

metadata/
	author
	difficulty
	sessionkey
	preview

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:

string_metadata/
	author
	difficulty
file_metadata/
	sessionkey
	preview

I hope that these designs may allow your datastore to become even simpler.

- --Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjZPGkACgkQUJT6e6HFtqTepQCdEvOgcaFsvfmhEu0tk0q0in4A
/qMAnin7C9wP/7avdyrtztd7sBXLGx8z
=37uH
-----END PGP SIGNATURE-----



More information about the Sugar-devel mailing list