[Vobject] Hash-based access to elements and element filtering
Johann Richard
info at mycvs.org
Thu Dec 16 05:10:37 CST 2004
Hi list
Jeffrey encouraged me to post this two suggestions to the list, so here
they are.
1. Hash-based access to children of a component
I am working on some code to do calendar syncing. One of the
requirements
so far is speed. Iterating through all children of a component (e.g. all
VEVENTS in a VCALENDAR) is very expensive.
My feature wish is thus, that some kind of hash-based access to child-
elements is provided.
* Every component has some kind of "hash"
attribute that uniquely identifies it
* If a component has an UID, this will be used as hash
* If there is no UID, a hash will be computed from the
most important fields of that component (or all)
(DTSTART, SUMMARY and the like)
* Every component has not a simple array of children but
a dictionary containing the hashes of its children,
meaning a child could be fetched by getting it via it's hash.
* Components implement __contains__() that will
simply check if a child-component is found in
the dictionary (resorting to the childrens hashes again)
* If you think that using the UID, regardless of the other attribute
values
is a bad idea, I would further suggest to add some kind of "relation"
dict.
That is, a dictionary that has UID's as keys and will yield a hash
that can then be used to get the object. IMHO, this would solve
the problem that two components w/ the same UID but different values
(from different calendars, of course) would be treated as "the same"
simply because of the same UID.
ISSUE can be found here:
[ http://vobject.skyhouseconsulting.com/bugs/issue5 ]
2. "Filtering" functions
One common tasks with calendaring is "filtering" events, typically by
date
or kind (appointments etc).
While this can be done by your own program, it would be great if vobject
(in the future) supported some kind of "filter" behaviour where a custom
filtering function could be plugged in.
Of course, this would require some kind of fast iterator or whatever,
probably based on hashes or so. See
http://vobject.skyhouseconsulting.com/
bugs/issue5 for some more info on hash based access to children of
components.
ISSUE can be found here:
[ http://vobject.skyhouseconsulting.com/bugs/issue6 ]
************************************************
That's it. Comments are welcome and I might as well add some patches to
the issues that demonstrate what I'd like to see.
Regards
Johann
--
************************************************
Johann Richard
Switzerland
e-mail: mailto:info at mycvs.org
************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2104 bytes
Desc: not available
Url : http://lists.skyhouseconsulting.com/pipermail/vobject/attachments/20041216/7f50519e/smime.bin
More information about the Vobject
mailing list