[CalendarServer-changes] [10241] CalendarServer/branches/users/glyph/queue-locking-and-timing
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 4 16:38:57 PST 2013
Revision: 10241
http://trac.calendarserver.org//changeset/10241
Author: glyph at apple.com
Date: 2013-01-04 16:38:57 -0800 (Fri, 04 Jan 2013)
Log Message:
-----------
Lock schema.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/queue.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/queue-locking-and-timing/
Modified: CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/queue.py
===================================================================
--- CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/queue.py 2013-01-05 00:38:56 UTC (rev 10240)
+++ CalendarServer/branches/users/glyph/queue-locking-and-timing/twext/enterprise/queue.py 2013-01-05 00:38:57 UTC (rev 10241)
@@ -131,14 +131,18 @@
def makeNodeSchema(inSchema):
"""
- Create a self-contained schema for L{NodeInfo} to use.
+ Create a self-contained schema for L{NodeInfo} to use, in C{inSchema}.
+ @param inSchema: a L{Schema} to add the node-info table to.
+ @type inSchema: L{Schema}
+
@return: a schema with just the one table.
"""
# Initializing this duplicate schema avoids a circular dependency, but this
# should really be accomplished with independent schema objects that the
# transaction is made aware of somehow.
NodeTable = Table(inSchema, 'NODE_INFO')
+
NodeTable.addColumn("HOSTNAME", SQLType("varchar", 255))
NodeTable.addColumn("PID", SQLType("integer", None))
NodeTable.addColumn("PORT", SQLType("integer", None))
@@ -151,11 +155,35 @@
NodeTable.tableConstraint(Constraint.NOT_NULL, [column.name])
NodeTable.primaryKey = [NodeTable.columnNamed("HOSTNAME"),
NodeTable.columnNamed("PORT")]
+
return inSchema
NodeInfoSchema = SchemaSyntax(makeNodeSchema(Schema(__file__)))
+
+def makeLockSchema(inSchema):
+ """
+ Create a self-contained schema just for L{Locker} use, in C{inSchema}.
+
+ @param inSchema: a L{Schema} to add the locks table to.
+ @type inSchema: L{Schema}
+
+ @return: inSchema
+ """
+ LockTable = Table(inSchema, 'NAMED_LOCKS')
+
+ LockTable.addColumn("LOCK_NAME", SQLType("varchar", 255))
+ LockTable.tableConstraint(Constraint.NOT_NULL, ["LOCK_NAME"])
+ LockTable.tableConstraint(Constraint.UNIQUE, ["LOCK_NAME"])
+ LockTable.primaryKey = [LockTable.columnNamed("LOCK_NAME")]
+
+ return inSchema
+
+LockSchema = SchemaSyntax(makeLockSchema(Schema(__file__)))
+
+
+
@inlineCallbacks
def inTransaction(transactionCreator, operation):
"""
@@ -410,7 +438,6 @@
-
class Locker(object):
"""
Acquire named locks against a database.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130104/1f26c9b6/attachment.html>
More information about the calendarserver-changes
mailing list