[CalendarServer-changes] [3027] CalendarServer/branches/users/cdaboo/clustering-3012

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 19 07:30:38 PDT 2008


Revision: 3027
          http://trac.macosforge.org/projects/calendarserver/changeset/3027
Author:   cdaboo at apple.com
Date:     2008-09-19 07:30:35 -0700 (Fri, 19 Sep 2008)
Log Message:
-----------
Some config for clustering.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/clustering-3012/conf/caldavd.plist
    CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/config.py

Added Paths:
-----------
    CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/clustering.py

Modified: CalendarServer/branches/users/cdaboo/clustering-3012/conf/caldavd.plist
===================================================================
--- CalendarServer/branches/users/cdaboo/clustering-3012/conf/caldavd.plist	2008-09-19 07:20:33 UTC (rev 3026)
+++ CalendarServer/branches/users/cdaboo/clustering-3012/conf/caldavd.plist	2008-09-19 14:30:35 UTC (rev 3027)
@@ -67,7 +67,6 @@
     <array>
     </array>
 
-
     <!--
         Data Store
       -->
@@ -275,6 +274,22 @@
     </dict>
 
 
+	<!-- Configuration for clustering -->
+	<key>Clustering</key>
+	<dict>
+		<key>Enabled</key>
+		<string>False</string>
+
+		<key>NodeIDHostnameMap</key>
+		<dict></dict>
+		
+		<key>NodeID</key>
+		<string></string>
+		
+		<key>UserNodeMapFile</key>
+		<string>/etc/caldavd/usernodemap.plist</string>
+	</dict>
+	
     <!--
         Notifications
       -->

Added: CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/clustering.py
===================================================================
--- CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/clustering.py	                        (rev 0)
+++ CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/clustering.py	2008-09-19 14:30:35 UTC (rev 3027)
@@ -0,0 +1,51 @@
+##
+# Copyright (c) 2008 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from twistedcaldav.config import config
+from twistedcaldav.log import Logger
+from twistedcaldav.py.plistlib import readPlist
+
+log = Logger()
+
+class ClusterManager(object):
+    
+    def __init__(self):
+        self.updateConfig()
+
+    def updateConfig(self):
+
+        # Map of nodes to hosts/ips
+        self.node_host_map = config.Clustering["NodeIDHostnameMap"]
+
+        # Get this nodes' host id
+        self.node_id = config.Clustering["NodeID"]
+
+        # Read in the hosted users
+        plist = readPlist(config.Clustering["UserNodeMapFile"])
+
+        self.hosted_guids = plist()['guids']
+
+    def isHostedGUID(self, guid):
+        try:
+            return self.hosted_guids[guid] == self.node_id
+        except KeyError:
+            return False 
+
+    def getHostForGUID(self, guid):
+        try:
+            return self.node_host_map[self.hosted_guids[guid]]
+        except KeyError:
+            return None 

Modified: CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/config.py	2008-09-19 07:20:33 UTC (rev 3026)
+++ CalendarServer/branches/users/cdaboo/clustering-3012/twistedcaldav/config.py	2008-09-19 14:30:35 UTC (rev 3027)
@@ -181,6 +181,17 @@
     "EnableAutoAcceptTrigger" : False, # Manually trigger auto-accept behavior
     
     #
+    # Clustering related options
+    #
+    
+    "Clustering" : {
+        "Enabled"               : False,                            # Option enabled?
+        "NodeIDHostnameMap"     : {},                               # Map from NodeID to hostnames/ips
+        "NodeID"                : "",                               # ID for this node
+        "UserNodeMapFile"       : "/etc/caldavd/usernodemap.plist", # plist containing a dict mapping user GUIDs to node-id.
+    },
+
+    #
     # Scheduling related options
     #
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080919/7f402e0f/attachment.html 


More information about the calendarserver-changes mailing list