[CalendarServer-changes] [9537] CalendarServer/branches/users/gaya/inviteclean

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 7 15:36:33 PDT 2012


Revision: 9537
          http://trac.macosforge.org/projects/calendarserver/changeset/9537
Author:   gaya at apple.com
Date:     2012-08-07 15:36:31 -0700 (Tue, 07 Aug 2012)
Log Message:
-----------
remove notificationsDB(), PostgresLegacyNotificationsEmulator

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
    CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py
    CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
    CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql_legacy.py

Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py	2012-08-07 18:53:38 UTC (rev 9536)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/sharing.py	2012-08-07 22:36:31 UTC (rev 9537)
@@ -667,10 +667,11 @@
         sharee = self.principalForUID(invitation.shareeUID())
         if sharee is None:
             raise ValueError("sharee is None but principalUID was valid before")
-        notifications = (yield request.locateResource(sharee.notificationURL()))
+        notificationResource = (yield request.locateResource(sharee.notificationURL()))
+        notifications = notificationResource._newStoreNotifications
         
         # Add to collections
-        yield notifications.deleteNotifictionMessageByUID(request, invitation.uid())
+        yield notifications.removeNotificationObjectWithUID(invitation.uid())
 
     @inlineCallbacks
     def _xmlHandleInvite(self, request, docroot):
@@ -1302,7 +1303,8 @@
 
         # Locate notifications collection for sharer
         sharer = (yield sharedCollection.ownerPrincipal(request))
-        notifications = (yield request.locateResource(sharer.notificationURL()))
+        notificationResource = (yield request.locateResource(sharer.notificationURL()))
+        notifications = notificationResource._newStoreNotifications
 
         # Generate invite XML
         notificationUID = "%s-reply" % (replytoUID,)
@@ -1338,7 +1340,7 @@
         ).toxml()
         
         # Add to collections
-        yield notifications.addNotification(request, notificationUID, xmltype, xmldata)
+        yield notifications.writeNotificationObject(notificationUID, xmltype, xmldata)
 
     def _handleInviteReply(self, request, invitereplydoc):
         """ Handle a user accepting or declining a sharing invite """

Modified: CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py	2012-08-07 18:53:38 UTC (rev 9536)
+++ CalendarServer/branches/users/gaya/inviteclean/twistedcaldav/storebridge.py	2012-08-07 22:36:31 UTC (rev 9537)
@@ -2182,13 +2182,6 @@
         return self.getChild(segments[0]), segments[1:]
 
 
-    def notificationsDB(self):
-        """
-        Retrieve the new-style index wrapper.
-        """
-        return self._newStoreNotifications.retrieveOldIndex()
-
-
     def exists(self):
         # FIXME: tests
         return True

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-07 18:53:38 UTC (rev 9536)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-07 22:36:31 UTC (rev 9537)
@@ -49,7 +49,6 @@
 
 from twext.internet.decorate import memoizedKey
 
-from txdav.common.datastore.sql_legacy import PostgresLegacyNotificationsEmulator
 from txdav.caldav.icalendarstore import ICalendarTransaction, ICalendarStore
 
 from txdav.carddav.iaddressbookstore import IAddressBookTransaction
@@ -2479,8 +2478,12 @@
         rows = None
         queryCacher = home._txn._queryCacher
         
-        
         # FIXME: Only caching non-shared objects so that we don't need to invalidate in sql_legacy
+        # NOTE: Currently, r-9500, if shared caching is enabled, 
+        #       Six failures when the following CardDAVTester files are run together
+        #               CardDAVTester/scripts/tests/CalDAV/sharing-freebusy.xml
+        #               CardDAVTester/scripts/tests/CalDAV/sharing-notification-sync.xml
+        #
         if queryCacher:
             # Retrieve data from cache
             cacheKey = queryCacher.keyForObjectWithName(home._resourceID, name)
@@ -3684,10 +3687,6 @@
         return ResourceType.notification #@UndefinedVariable
 
 
-    def retrieveOldIndex(self):
-        return PostgresLegacyNotificationsEmulator(self)
-
-
     def __repr__(self):
         return "<%s: %s>" % (self.__class__.__name__, self._resourceID)
 

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql_legacy.py	2012-08-07 18:53:38 UTC (rev 9536)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql_legacy.py	2012-08-07 22:36:31 UTC (rev 9537)
@@ -29,7 +29,6 @@
 from twistedcaldav.config import config
 from twistedcaldav.dateops import normalizeForIndex, pyCalendarTodatetime
 from twistedcaldav.memcachepool import CachePoolUserMixIn
-from twistedcaldav.notifications import NotificationRecord
 from twistedcaldav.query import \
     calendarqueryfilter, calendarquery, addressbookquery, expression, \
     addressbookqueryfilter
@@ -57,46 +56,6 @@
     4: 'T',
 }
 
-class PostgresLegacyNotificationsEmulator(object):
-    def __init__(self, notificationsCollection):
-        self._collection = notificationsCollection
-
-
-    @inlineCallbacks
-    def _recordForObject(self, notificationObject):
-        if notificationObject:
-            returnValue(
-                NotificationRecord(
-                    notificationObject.uid(),
-                    notificationObject.name(),
-                    (yield notificationObject.xmlType().toxml())
-                )
-            )
-        else:
-            returnValue(None)
-
-
-    def recordForName(self, name):
-        return self._recordForObject(
-            self._collection.notificationObjectWithName(name)
-        )
-
-
-    @inlineCallbacks
-    def recordForUID(self, uid):
-        returnValue((yield self._recordForObject(
-            (yield self._collection.notificationObjectWithUID(uid))
-        )))
-
-
-    def removeRecordForUID(self, uid):
-        return self._collection.removeNotificationObjectWithUID(uid)
-
-
-    def removeRecordForName(self, name):
-        return self._collection.removeNotificationObjectWithName(name)
-
-
 class MemcachedUIDReserver(CachePoolUserMixIn, LoggingMixIn):
     def __init__(self, index, cachePool=None):
         self.index = index
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120807/ebe38916/attachment.html>


More information about the calendarserver-changes mailing list