[CalendarServer-changes] [9626] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:55:02 PDT 2012


Revision: 9626
          http://trac.macosforge.org/projects/calendarserver/changeset/9626
Author:   glyph at apple.com
Date:     2012-08-11 01:55:02 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
details

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py	2012-08-11 08:55:01 UTC (rev 9625)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/queue.py	2012-08-11 08:55:02 UTC (rev 9626)
@@ -17,6 +17,9 @@
 from twisted.python.reflect import qual
 
 from twext.enterprise.dal.syntax import TableSyntax, SchemaSyntax
+from twext.enterprise.dal.model import ProcedureCall
+from twext.enterprise.dal.syntax import NamedValue
+from twext.enterprise.dal.record import fromTable
 from twext.enterprise.dal.model import Table, Schema, SQLType, Constraint
 
 
@@ -33,7 +36,11 @@
     masterTable.addColumn("HOSTNAME", SQLType("varchar", 255))
     masterTable.addColumn("PID", SQLType("integer", None))
     masterTable.addColumn("PORT", SQLType("integer", None))
-    masterTable.addColumn("TIME", SQLType("timestamp", None))
+    masterTable.addColumn("TIME", SQLType("timestamp", None)).setDefaultValue(
+        # Note: in the real data structure, this is actually a not-cleaned-up
+        # sqlparse internal data structure, but it *should* look closer to this.
+        ProcedureCall("timezone", ["UTC", NamedValue('CURRENT_TIMESTAMP')])
+    )
     for column in masterTable.columns:
         masterTable.tableConstraint(Constraint.NOT_NULL, [column.name])
     return inSchema
@@ -75,7 +82,7 @@
 
 
 
-class MasterInfo(object):
+class MasterInfo(fromTable(masterInfoSchema.MASTER_INFO)):
     """
     A L{MasterInfo} is information about a currently-active master process.
     """
@@ -88,10 +95,14 @@
         @return: an endpoint that will connect to this host.
         @rtype: L{IStreamServerEndpoint}
         """
-        return TCP4ClientEndpoint(self.host, self.ampPort)
+        return TCP4ClientEndpoint(self.hostname, self.port)
 
 
+    def updateCurrent(self):
+        return self.update(timestamp=datetime.datetime.now())
 
+
+
 def abstract(thunk):
     """
     The decorated function is abstract.
@@ -444,9 +455,7 @@
         Register ourselves with the database and establish all outgoing
         connections to other servers in the cluster.
         """
-
         self._doStart()
-        # Is there any need for a callback?
 
 
     @inlineCallbacks
@@ -495,15 +504,4 @@
         f = Factory()
         master.endpoint().connect(f)
 
-"""
-Notes:
 
-The master process is going to talk to a slave process by signaling via the
-logging (e.g.  "control") socket.  But it also needs to have a reference over
-to the meta-fd-dispatcher socket so it knows which one to talk to.
-
-Right now all the slave->master connections are established by the slaves
-coming in, so we need to work with whatever connections are availble and/or
-buffer until the first one comes in.
-"""
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/52186157/attachment.html>


More information about the calendarserver-changes mailing list