[CalendarServer-changes] [6608] CalendarServer/branches/users/glyph/dont-start-postgres

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 10 18:56:14 PST 2010


Revision: 6608
          http://trac.macosforge.org/projects/calendarserver/changeset/6608
Author:   glyph at apple.com
Date:     2010-11-10 18:56:11 -0800 (Wed, 10 Nov 2010)
Log Message:
-----------
Try to avoid calling pgServiceFromConfig; use AttachmentsRoot configuration value to figure out where the attachments are, rather than storing them in the database directory.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/util.py
    CalendarServer/branches/users/glyph/dont-start-postgres/twistedcaldav/stdconfig.py

Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/util.py	2010-11-11 02:55:54 UTC (rev 6607)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/util.py	2010-11-11 02:56:11 UTC (rev 6608)
@@ -135,9 +135,10 @@
     Produce an L{IDataStore} from the given configuration and notifier factory.
     """
     if config.UseDatabase:
-        postgresService = pgServiceFromConfig(config, None)
         if config.DBAMPFD == 0:
-            cp = ConnectionPool(postgresService.produceConnection)
+            cp = ConnectionPool(
+                pgServiceFromConfig(config, None).produceConnection
+            )
             cp.setServiceParent(serviceParent)
             txnFactory = cp.connection
         else:
@@ -152,7 +153,7 @@
             txnFactory = protocol.newTransaction
         dataStore = CommonSQLDataStore(
             txnFactory, notifierFactory,
-            postgresService.dataStoreDirectory.child("attachments"),
+            FilePath(config.AttachmentsRoot),
             config.EnableCalDAV, config.EnableCardDAV
         )
         dataStore.setServiceParent(serviceParent)
@@ -269,7 +270,7 @@
     return directory
 
 
-def getRootResource(config, serviceParent, resources=None):
+def getRootResource(config, serviceParent, resources=None, store=None):
     """
     Set up directory service and resource hierarchy based on config.
     Return root resource.
@@ -277,6 +278,9 @@
     Additional resources can be added to the hierarchy by passing a list of
     tuples containing: path, resource class, __init__ args list, and optional
     authentication scheme ("basic" or "digest").
+
+    If the store is specified, then it has already been constructed, so use it.
+    Otherwise build one with L{storeFromConfig}.
     """
 
     # FIXME: this is only here to workaround circular imports
@@ -397,7 +401,10 @@
     else:
         notifierFactory = None
 
-    newStore = storeFromConfig(config, serviceParent, notifierFactory)
+    if store is not None:
+        newStore = store
+    else:
+        newStore = storeFromConfig(config, serviceParent, notifierFactory)
 
     if config.EnableCalDAV:
         log.info("Setting up calendar collection: %r" % (calendarResourceClass,))

Modified: CalendarServer/branches/users/glyph/dont-start-postgres/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/twistedcaldav/stdconfig.py	2010-11-11 02:55:54 UTC (rev 6607)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/twistedcaldav/stdconfig.py	2010-11-11 02:56:11 UTC (rev 6608)
@@ -182,6 +182,7 @@
     "ServerRoot"              : "/var/db/caldavd",
     "DataRoot"                : "Data",
     "DatabaseRoot"            : "Database",
+    "AttachmentsRoot"         : "Attachments",
     "DocumentRoot"            : "Documents",
     "ConfigRoot"              : "/etc/caldavd",
     "LogRoot"                 : "/var/log/caldavd",
@@ -676,6 +677,7 @@
     ("ServerRoot", "LogRoot"),
     ("ServerRoot", "RunRoot"),
     ("DataRoot", "DatabaseRoot"),
+    ("DataRoot", "AttachmentsRoot"),
     ("ConfigRoot", "SudoersFile"),
     ("LogRoot", "AccessLogFile"),
     ("LogRoot", "ErrorLogFile"),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101110/3a2ab296/attachment.html>


More information about the calendarserver-changes mailing list