[Zodb-checkins] CVS: Packages/ZEO - ClientStorage.py:1.65.2.1 ServerStub.py:1.8.2.1 StorageServer.py:1.69.4.1
Toby Dickenson
tdickenson@geminidataloggers.com
Mon, 30 Sep 2002 04:16:55 -0400
Update of /cvs-repository/Packages/ZEO
In directory cvs.zope.org:/tmp/cvs-serv11070
Modified Files:
Tag: toby-extension-method-branch
ClientStorage.py ServerStub.py StorageServer.py
Log Message:
reimplement signals as instance methods
=== Packages/ZEO/ClientStorage.py 1.65 => 1.65.2.1 ===
--- Packages/ZEO/ClientStorage.py:1.65 Fri Sep 20 13:37:34 2002
+++ Packages/ZEO/ClientStorage.py Mon Sep 30 04:16:49 2002
@@ -274,6 +274,9 @@
def getSize(self):
return self._info['size']
+ def getExtensionMethods(self):
+ return self._info['extensionMethods']
+
def supportsUndo(self):
return self._info['supportsUndo']
@@ -325,6 +328,12 @@
def history(self, oid, version, length=1):
return self._server.history(oid, version, length)
+ def __getattr__(self,name):
+ if self.getExtensionMethods().has_key(name):
+ return self._server.extensionMethod(name)
+ else:
+ raise AttributeError(name)
+
def loadSerial(self, oid, serial):
return self._server.loadSerial(oid, serial)
@@ -589,3 +598,5 @@
invalidate = invalidateVerify
end = endVerify
Invalidate = invalidateTrans
+
+
=== Packages/ZEO/ServerStub.py 1.8 => 1.8.2.1 ===
--- Packages/ZEO/ServerStub.py:1.8 Sat Sep 7 20:20:20 2002
+++ Packages/ZEO/ServerStub.py Mon Sep 30 04:16:49 2002
@@ -18,6 +18,9 @@
def __init__(self, rpc):
self.rpc = rpc
+ def extensionMethod(self,name):
+ return ExtensionMethodWrapper(self.rpc,name).call
+
def _update(self):
self.rpc.pending()
@@ -117,3 +120,10 @@
return self.rpc.call('versions')
else:
return self.rpc.call('versions', max)
+
+class ExtensionMethodWrapper:
+ def __init__(self,rpc,name):
+ self.rpc = rpc
+ self.name = name
+ def call(self,*a,**kwa):
+ return apply(self.rpc.call,(self.name,)+a,kwa)
=== Packages/ZEO/StorageServer.py 1.69 => 1.69.4.1 ===
--- Packages/ZEO/StorageServer.py:1.69 Fri Sep 20 15:03:48 2002
+++ Packages/ZEO/StorageServer.py Mon Sep 30 04:16:49 2002
@@ -160,6 +160,13 @@
self.load = self.storage.load
self.loadSerial = self.storage.loadSerial
self.modifiedInVersion = self.storage.modifiedInVersion
+ try:
+ fn = self.storage.getExtensionMethods
+ except AttributeError:
+ pass
+ else:
+ for name in fn().keys():
+ setattr(self,name,getattr(self.storage,name))
def check_tid(self, tid, exc=None):
caller = sys._getframe().f_back.f_code.co_name
@@ -210,12 +217,21 @@
'supportsVersions': self.storage.supportsVersions(),
'supportsTransactionalUndo':
self.storage.supportsTransactionalUndo(),
+ 'extensionMethods': self.getExtensionMethods(),
}
def get_size_info(self):
return {'length': len(self.storage),
'size': self.storage.getSize(),
}
+
+ def getExtensionMethods(self):
+ try:
+ e = self.storage.getExtensionMethods
+ except AttributeError:
+ return {}
+ else:
+ return e()
def zeoLoad(self, oid):
v = self.storage.modifiedInVersion(oid)