[CalendarServer-changes] [10049] CalendarServer/branches/users/glyph/one-home-list-api
source_changes at macosforge.org
source_changes at macosforge.org
Fri Nov 16 14:48:42 PST 2012
Revision: 10049
http://trac.calendarserver.org//changeset/10049
Author: glyph at apple.com
Date: 2012-11-16 14:48:42 -0800 (Fri, 16 Nov 2012)
Log Message:
-----------
Add new 'withEachCalendarHomeDo' interface, along with a basic description of how it should work.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/icalendarstore.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/one-home-list-api/
Modified: CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/icalendarstore.py
===================================================================
--- CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/icalendarstore.py 2012-11-16 22:44:48 UTC (rev 10048)
+++ CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/icalendarstore.py 2012-11-16 22:48:42 UTC (rev 10049)
@@ -114,7 +114,7 @@
API root for calendar data storage.
"""
- def eachCalendarHome(self):
+ def eachCalendarHome():
"""
Enumerate all calendar homes in this store, with each one in an
accompanying transaction.
@@ -125,7 +125,44 @@
"""
+ def withEachCalendarHomeDo(action, batchSize=None):
+ """
+ Execute a given action with each calendar home present in this store,
+ in serial, committing after each batch of homes of a given size.
+ @note: This does not execute an action with each directory principal
+ for which there might be a calendar home; it works only on calendar
+ homes which have already been provisioned. To execute an action on
+ every possible calendar user, you will need to inspect the
+ directory API instead.
+
+ @note: The list of calendar homes is loaded incrementally, so this will
+ not necessarily present a consistent snapshot of the entire
+ database at a particular moment. (If this behavior is desired,
+ pass a C{batchSize} greater than the number of homes in the
+ database.)
+
+ @param action: a 2-argument callable, taking an L{ICalendarTransaction}
+ and an L{ICalendarHome}, and returning a L{Deferred} that fires
+ with C{None} when complete. Note that C{action} should not commit
+ or abort the given L{ICalendarTransaction}. If C{action} completes
+ normally, then it will be called again with the next
+ L{ICalendarHome}. If it raises an exception or returns a
+ L{Deferred} that fails, processing will stop and the L{Deferred}
+ returned from C{withEachCalendarHomeDo} will fail with that same
+ L{Failure}.
+ @type action: L{callable}
+
+ @param batchSize: The maximum count of calendar homes to include in a
+ single transaction.
+ @type batchSize: L{int}
+
+ @return: a L{Deferred} which fires with L{None} when all homes have
+ completed processing, or fails with the traceback.
+ """
+
+
+
#
# Interfaces
#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121116/0cba72e6/attachment.html>
More information about the calendarserver-changes
mailing list