[CalendarServer-changes] [3932] CalendarServer/branches/users/wsanchez/deployment/bin/caldav_warmup

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 27 13:45:58 PDT 2009


Revision: 3932
          http://trac.macosforge.org/projects/calendarserver/changeset/3932
Author:   wsanchez at apple.com
Date:     2009-03-27 13:45:57 -0700 (Fri, 27 Mar 2009)
Log Message:
-----------
Add read options

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/deployment/bin/caldav_warmup

Modified: CalendarServer/branches/users/wsanchez/deployment/bin/caldav_warmup
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/bin/caldav_warmup	2009-03-27 19:29:18 UTC (rev 3931)
+++ CalendarServer/branches/users/wsanchez/deployment/bin/caldav_warmup	2009-03-27 20:45:57 UTC (rev 3932)
@@ -144,6 +144,9 @@
     print "  -H --home: add a calendar home (and all calendars within it)"
     print "  -r --record: add a directory record's calendar home (format: 'recordType:shortName')"
     print "  -u --user: add a user's calendar home (shorthand for '-r users:shortName')"
+    print "  --no-icalendar: Don't read iCalendar data"
+    print "  --no-properties: Don't read DAV properties"
+    print "  --no-index: Don't read indexes"
 
     if e:
         sys.exit(64)
@@ -153,11 +156,12 @@
 def main():
     try:
         (optargs, args) = getopt(
-            sys.argv[1:], "hf:o:aH:r:u:F", [
+            sys.argv[1:], "hf:o:aH:r:u:", [
                 "config=",
                 "output=",
                 "help",
                 "all", "home=", "record=", "user=",
+                "no-icalendar", "no-properties", "no-index",
             ],
         )
     except GetoptError, e:
@@ -170,6 +174,8 @@
     records = set()
     allRecords = False
     readCalendarData = True
+    readProperties = True
+    readIndexes = True
 
     observer = log.FileLogObserver(open("/ngs/app/icalt/warmup/warmup.log", "a"))
     log.addObserver(observer.emit)
@@ -189,9 +195,15 @@
         elif opt in ("-a", "--all"):
             allRecords = True
 
-        elif opt in ("-F",):
+        elif opt in ("--no-icalendar",):
             readCalendarData = False
 
+        elif opt in ("--no-properties",):
+            readProperties = False
+
+        elif opt in ("--no-indexes",):
+            readIndexes = False
+
         elif opt in ("-H", "--home"):
             path = abspath(arg)
             parent = CalDAVFile(dirname(abspath(path)))
@@ -241,35 +253,61 @@
     for calendarHome in calendarHomes:
         n += 1
         log.msg("%.2f%% (%d of %d)" % (100.0 * n/N, n, N))
-        processCalendarHome(calendarHome, readCalendarData=readCalendarData)
+        processCalendarHome(
+            calendarHome,
+            readCalendarData = readCalendarData,
+            readProperties = readProperties,
+            readIndexes = readIndexes,
+        )
 
-def processCalendarHome(calendarHome, readCalendarData=True):
-    readProperties(calendarHome)
+def processCalendarHome(
+    calendarHome,
+    readCalendarData = True,
+    readProperties = True,
+    readIndexes = True
+):
+    if readProperties:
+        readPropertiesForResource(calendarHome)
 
     for childName in calendarHome.listChildren():
         child = calendarHome.getChild(childName)
         if isPseudoCalendarCollectionResource(child):
             if childName in ("inbox", "outbox"):
                 child.provision()
-            processCalendar(child, readCalendarData=readCalendarData)
+            processCalendar(
+                child,
+                readCalendarData = readCalendarData,
+                readProperties = readProperties,
+                readIndexes = readIndexes,
+            )
 
-def processCalendar(calendarCollection, readCalendarData=True):
-    readProperties(calendarCollection)
+def processCalendar(
+    calendarCollection,
+    readCalendarData = True,
+    readProperties = True,
+    readIndexes = True
+):
+    if readProperties:
+        readPropertiesForResource(calendarCollection)
 
-    try:
-        for name, uid, type in calendarCollection.index().search(None):
-            child = calendarCollection.getChild(name)
+    if readIndexes:
+        try:
+            for name, uid, type in calendarCollection.index().search(None):
+                pass
+        except sqlite3.OperationalError:
+            # Outbox doesn't live on disk
+            if calendarCollection.fp.basename() != "outbox":
+                raise
 
-            if readCalendarData:
-                childCalendar = child.iCalendarText()
-            readProperties(child)
+    for name in calendarCollection.listChildren()
+        child = calendarCollection.getChild(name)
 
-    except sqlite3.OperationalError:
-        # Outbox doesn't live on disk
-        if calendarCollection.fp.basename() != "outbox":
-            raise
+        if readCalendarData:
+            childCalendar = child.iCalendarText()
+        if readProperties:
+            readPropertiesForResource(child)
 
-def readProperties(resource):
+def readPropertiesForResource(resource):
     log.msg(resource)
     for qname in tuple(resource.deadProperties().list()):
         try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090327/266ec0a6/attachment.html>


More information about the calendarserver-changes mailing list