Commit 8388009c authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #283 from zopefoundation/issue282

Make TmpStore implement its own getSize
parents 2f8cc67a 0d089b4e
......@@ -24,6 +24,11 @@
holds bytes as they are stored (i.e. no deserialization happens).
See `issue 207 <https://github.com/zopefoundation/ZODB/pull/207>`_.
- Make a connection's savepoint storage implement its own
(approximate) ``getSize`` method instead of relying on the original
storage. Previously, this produced confusing DEBUG logging. See
`issue 282 <https://github.com/zopefoundation/ZODB/issues/282>`_.
5.5.1 (2018-10-25)
==================
......
......@@ -1135,21 +1135,23 @@ class TmpStore(object):
def __init__(self, storage):
self._storage = storage
for method in (
'getName', 'new_oid', 'getSize', 'sortKey',
'getName', 'new_oid', 'sortKey',
'isReadOnly'
):
setattr(self, method, getattr(storage, method))
self._file = tempfile.TemporaryFile(prefix='TmpStore')
# position: current file position
# _tpos: file position at last commit point
# position: current file position. If objects are only stored
# once, this is approximately the byte size of object data stored.
self.position = 0
# index: map oid to pos of last committed version
self.index = {}
self.creating = {}
self._blob_dir = None
def getSize(self):
return self.position
def __len__(self):
return len(self.index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment