[sugar] Datastore: uid, entry_id, object_id, activity_id ?
Mon Mar 10 04:58:36 EDT 2008
On Sun, Mar 9, 2008 at 11:40 PM, Benjamin M. Schwartz
<bmschwar at fas.harvard.edu> wrote:
> Tomeu Vizoso wrote:
> | On Sat, Mar 8, 2008 at 11:17 PM, Benjamin M. Schwartz
> | <bmschwar at fas.harvard.edu> wrote:
> |> According to this page:
> http://wiki.laptop.org/go/Journal_entry_bundles ...
> |> Each journal entry has a unique "uid". This 'uid' is listed in its
> |> metadata, and a conforming Journal Entry Bundle uses the uid calue to name
> |> various components of the bundle. However, the DSMetadata object
> |> retrieved by calling dsobject.get_metadata() does not have a 'uid' key.
> |> What is the uid, and, given a DSObject, how am I supposed to determine it?
> | Use the object_id attribute of the DSObject:
> | http://tinyurl.com/2sgulm
> OK. On http://wiki.laptop.org/go/Journal_entry_bundles, you gave an
> example of activity metadata:
> ~ "title_set_by_user":"0",
> ~ "uid":"15b114ad-1eed-461f-9315-129bba41ce2d",
> ~ "vid":"1.0",
> ~ "title":"Paint Activity",
> ~ "timestamp":"1192547469",
> ~ "activity":"org.laptop.Oficina",
> ~ "filename":"",
> ~ "icon-color":"#00588C,#00EA11",
> ~ "mtime":"2007-10-16T17:11:09",
> ~ "mountpoint":"18d7246f-72a4-4089-b7dc-2dbdf2b81aa6",
> ~ "keep":"0",
> ~ "mime_type":"image/png",
> ~ "preview":"15b114ad-1eed-461f-9315-129bba41ce2d"}
> This metadata dict contains a 'uid' key. Currently, the metadata
> associated with a DSObject has no such key. Is this a bug in the
> datastore, a problem with that wiki page, or a misunderstanding on my part?
Well, the metadata word is being used with four meanings:
1. conceptually, key-value pairs that help describe an entry.
2. dictionary returned by the datastore,
3. dictionary contained by DSObject,
4. dictionary in a json file in serialized entries.
In 2 and 4, the uid is contained as part of the metadata. Regarding 1,
I would say that the key is not part of the metadata. And that's the
reason why the uid lives in DSObject.object_id and not in
I think that metadata can be changed during the live of a journal
entry, but the uid will always stay the same. If the uid was part of
the metadata and the user of the API changed it, would be clear that a
new entry would be created? I think this would complicate
unnecessarily the API.
So we have an inconsistency here between the different parts of the
system that expose the metadata of a journal entry. We also have the
same inconsistency inside the low level DS API, as update() accepts
both an uid parameter and a metadata dict.
So, in my opinion the uid should not be considered part of the
metadata but given the current state of the DS it may not be the best
moment to do this change.
More information about the Sugar-devel