[Zope3-checkins] CVS: Zope3/lib/python/ZEO - ClientStorage.py:1.45 StorageServer.py:1.43
Jeremy Hylton
jeremy@zope.com
Tue, 26 Nov 2002 12:41:51 -0500
Update of /cvs-repository/Zope3/lib/python/ZEO
In directory cvs.zope.org:/tmp/cvs-serv23161/ZEO
Modified Files:
ClientStorage.py StorageServer.py
Log Message:
Big set of interlocking changes.
Implement much more of pickling functionality in Serialize module.
Rename pickler and unpickler classes to ObjectWriter and ObjectReader,
since they use pickles internally but aren't themselves picklers.
Connection now uses an ObjectWriter instead of calling pickle
directly.
Remove second argument from pack. Call the findrefs() function from
Serialize directly rather than passing it around everywhere. There's
far more work to be done to make serialization pluggable and this only
made matters more complicated.
Change __name__ attribute of storages to _name, since it __ names
suggested that they are reserved or special and this attribute isn't.
XXX Make minimal changes to ExportImport, but it should be using
Serialize rather than using a pickler directly.
Remove new_persistent_id() factory function. persistent_id() is now a
method on the ObjectWriter.
Remove __len__() and getSize() methods from storage API, at least for
now.
=== Zope3/lib/python/ZEO/ClientStorage.py 1.44 => 1.45 ===
--- Zope3/lib/python/ZEO/ClientStorage.py:1.44 Fri Nov 22 16:24:53 2002
+++ Zope3/lib/python/ZEO/ClientStorage.py Tue Nov 26 12:41:20 2002
@@ -222,7 +222,7 @@
self._serials = []
self._seriald = {}
- self.__name__ = name or str(addr) # Standard convention for storages
+ self._name = name or str(addr) # Standard convention for storages
# A ClientStorage only allows one thread to commit at a time.
# Mutual exclusion is achieved using _tpc_cond, which
@@ -408,11 +408,6 @@
self._connection = None
self._server = disconnected_stub
- def __len__(self):
- """Return the size of the storage."""
- # XXX Where is this used?
- return self._info['length']
-
def getName(self):
"""Storage API: return the storage name as a string.
@@ -423,13 +418,9 @@
connected.
"""
return "%s (%s)" % (
- self.__name__,
+ self._name,
self.is_connected() and "connected" or "disconnected")
- def getSize(self):
- """Storage API: an approximate size of the database, in bytes."""
- return self._info['size']
-
def getExtensionMethods(self):
"""getExtensionMethods
@@ -565,7 +556,7 @@
finally:
self._oid_lock.release()
- def pack(self, t=None, referencesf=None, wait=1, days=0):
+ def pack(self, t=None, wait=1, days=0):
"""Storage API: pack the storage.
Deviations from the Storage API: the referencesf argument is
=== Zope3/lib/python/ZEO/StorageServer.py 1.42 => 1.43 ===
--- Zope3/lib/python/ZEO/StorageServer.py:1.42 Fri Nov 22 16:24:53 2002
+++ Zope3/lib/python/ZEO/StorageServer.py Tue Nov 26 12:41:20 2002
@@ -36,7 +36,6 @@
import zLOG
from ZODB.POSException import StorageError, StorageTransactionError
from ZODB.POSException import TransactionError, ReadOnlyError
-from ZODB.referencesf import referencesf
_label = "ZSS" # Default label used for logging.
@@ -303,21 +302,13 @@
self.server.register_connection(storage_id, self)
def get_info(self):
- return {'length': len(self.storage),
- 'size': self.storage.getSize(),
- 'name': self.storage.getName(),
- 'supportsUndo': self.storage.supportsUndo(),
+ return {'name': self.storage.getName(),
'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
@@ -371,10 +362,10 @@
def pack_impl(self, time):
self.log("pack(time=%s) started..." % repr(time))
- self.storage.pack(time, referencesf)
+ self.storage.pack(time)
self.log("pack(time=%s) complete" % repr(time))
# Broadcast new size statistics
- self.server.invalidate(0, self.storage_id, (), self.get_size_info())
+ self.server.invalidate(0, self.storage_id, ())
def new_oids(self, n=100):
"""Return a sequence of n new oids, where n defaults to 100"""
@@ -432,7 +423,7 @@
invalidated = self.strategy.tpc_finish()
if invalidated:
self.server.invalidate(self, self.storage_id,
- invalidated, self.get_size_info())
+ invalidated)
self.transaction = None
self.strategy = None
self.handle_waiting()