[CalendarServer-changes] [6022] CalendarServer/branches/users/glyph/sql-store
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 9 15:16:49 PDT 2010
Revision: 6022
http://trac.macosforge.org/projects/calendarserver/changeset/6022
Author: sagen at apple.com
Date: 2010-08-09 15:16:48 -0700 (Mon, 09 Aug 2010)
Log Message:
-----------
Slaves are not spawned until postgres is ready; added config option to disable database use (go back to file system)
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/caldav.py
CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/util.py
CalendarServer/branches/users/glyph/sql-store/twistedcaldav/stdconfig.py
Modified: CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/caldav.py 2010-08-09 21:43:08 UTC (rev 6021)
+++ CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/caldav.py 2010-08-09 22:16:48 UTC (rev 6022)
@@ -703,26 +703,23 @@
loggingService.setName("logging")
loggingService.setServiceParent(s)
+ monitor = DelayedStartupProcessMonitor()
+ s.processMonitor = monitor
- #
- # Postgres
- #
- dbRoot = CachingFilePath(config.DatabaseRoot)
+ if config.UseDatabase:
+ # Postgres: delay spawning child processes until database is up
- def subServiceFactory(connectionFactory):
- return PostgresStore(
- connectionFactory("FIXME: What label to use here?"),
- None, # No notifier for master
- dbRoot.child("attachments")
- )
+ dbRoot = CachingFilePath(config.DatabaseRoot)
- PostgresService(dbRoot, subServiceFactory, v1_schema,
- "caldav").setServiceParent(s)
+ def subServiceFactory(connectionFactory):
+ return monitor
- monitor = DelayedStartupProcessMonitor()
- monitor.setServiceParent(s)
- s.processMonitor = monitor
+ PostgresService(dbRoot, subServiceFactory, v1_schema,
+ "caldav").setServiceParent(s)
+ else:
+ monitor.setServiceParent(s)
+
parentEnv = {
"PATH": os.environ.get("PATH", ""),
"PYTHONPATH": os.environ.get("PYTHONPATH", ""),
Modified: CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/util.py 2010-08-09 21:43:08 UTC (rev 6021)
+++ CalendarServer/branches/users/glyph/sql-store/calendarserver/tap/util.py 2010-08-09 22:16:48 UTC (rev 6022)
@@ -67,6 +67,7 @@
from calendarserver.webadmin.resource import WebAdminResource
from calendarserver.webcal.resource import WebCalendarResource
+from txdav.common.datastore.file import CommonDataStore
from txcaldav.calendarstore.postgres import PostgresStore, v1_schema
from txdav.datastore.subpostgres import PostgresService
from twext.python.filepath import CachingFilePath
@@ -289,14 +290,16 @@
else:
notifierFactory = None
+ if config.UseDatabase:
+ _newStore = CommonDataStore(FilePath(config.DocumentRoot),
+ notifierFactory, config.EnableCalDAV, config.EnableCardDAV)
+ else:
+ _dbRoot = CachingFilePath(config.DatabaseRoot)
+ _postgresService = PostgresService(_dbRoot, None, v1_schema, "caldav")
+ _newStore = PostgresStore(_postgresService.produceConnection,
+ notifierFactory, # config.EnableCalDAV, config.EnableCardDAV)
+ _dbRoot.child("attachments"))
- # Need a data store
- _dbRoot = CachingFilePath(config.DatabaseRoot)
- _postgresService = PostgresService(_dbRoot, None, v1_schema, "caldav")
- _newStore = PostgresStore(_postgresService.produceConnection,
- notifierFactory, # config.EnableCalDAV, config.EnableCardDAV)
- _dbRoot.child("attachments"))
-
if config.EnableCalDAV:
log.info("Setting up calendar collection: %r" % (calendarResourceClass,))
calendarCollection = calendarResourceClass(
Modified: CalendarServer/branches/users/glyph/sql-store/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/twistedcaldav/stdconfig.py 2010-08-09 21:43:08 UTC (rev 6021)
+++ CalendarServer/branches/users/glyph/sql-store/twistedcaldav/stdconfig.py 2010-08-09 22:16:48 UTC (rev 6022)
@@ -149,6 +149,8 @@
"UseMetaFD": True, # Use a 'meta' FD, i.e. an FD to transmit other
# FDs to slave processes.
+ "UseDatabase" : True, # True: postgress; False: files
+
#
# Types of service provided
#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100809/59048e81/attachment-0001.html>
More information about the calendarserver-changes
mailing list