[CalendarServer-changes] [7776] CalendarServer/trunk/twistedcaldav/directory
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 12 10:16:10 PDT 2011
Revision: 7776
http://trac.macosforge.org/projects/calendarserver/changeset/7776
Author: sagen at apple.com
Date: 2011-07-12 10:16:09 -0700 (Tue, 12 Jul 2011)
Log Message:
-----------
Speed up the fetching of proxyDB members
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
CalendarServer/trunk/twistedcaldav/directory/directory.py
CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipalmembers.py
Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2011-07-12 01:16:17 UTC (rev 7775)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2011-07-12 17:16:09 UTC (rev 7776)
@@ -787,8 +787,11 @@
yield super(ProxyDB, self).clean()
@inlineCallbacks
- def getAllGroups(self):
- returnValue([row[0] for row in (yield self.query("select DISTINCT GROUPNAME from GROUPS"))])
+ def getAllMembers(self):
+ """
+ Retrieve all members that have been directly delegated to
+ """
+ returnValue([row[0] for row in (yield self.query("select DISTINCT MEMBER from GROUPS"))])
ProxyDBService = None # Global proxyDB service
Modified: CalendarServer/trunk/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/directory.py 2011-07-12 01:16:17 UTC (rev 7775)
+++ CalendarServer/trunk/twistedcaldav/directory/directory.py 2011-07-12 17:16:09 UTC (rev 7776)
@@ -496,18 +496,7 @@
self.log_debug("Updating group membership cache")
- guids = set()
-
- proxyGroups = (yield self.proxyDB.getAllGroups())
- for proxyGroup in proxyGroups:
-
- # Protect against bogus entries in proxy db:
- if "#" not in proxyGroup:
- continue
-
- for guid in (yield self.proxyDB.getMembers(proxyGroup)):
- guids.add(guid)
-
+ guids = set((yield self.proxyDB.getAllMembers()))
returnValue((yield self.directory.cacheGroupMembership(guids, fast=fast)))
Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipalmembers.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipalmembers.py 2011-07-12 01:16:17 UTC (rev 7775)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_proxyprincipalmembers.py 2011-07-12 17:16:09 UTC (rev 7776)
@@ -577,3 +577,13 @@
provisioningResource.principalForUID(uid)
+ @inlineCallbacks
+ def test_getAllMembers(self):
+ """
+ getAllMembers( ) returns the unique set of guids that have been
+ delegated-to directly
+ """
+ self.assertEquals(
+ set((yield calendaruserproxy.ProxyDBService.getAllMembers())),
+ set([u'6423F94A-6B76-4A3A-815B-D52CFD77935D', u'8A985493-EE2C-4665-94CF-4DFEA3A89500', u'9FF60DAD-0BDE-4508-8C77-15F0CA5C8DD2', u'both_coasts', u'left_coast', u'non_calendar_group', u'recursive1_coasts', u'recursive2_coasts'])
+ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110712/ebb0deea/attachment.html>
More information about the calendarserver-changes
mailing list