Commit 3d8bc1dd authored by Barry Warsaw's avatar Barry Warsaw

getSize(): Seems appropriate to move this from the Autopack storage

into the BerkeleyBase class so all the derived storages (which all
share the zodb_pickles table) can benefit.

This makes loadmail.py work for any of the derived storages.
parent 01607318
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""An autopacking Berkeley storage without undo and versioning. """An autopacking Berkeley storage without undo and versioning.
""" """
__version__ = '$Revision: 1.3 $'.split()[-2:][0] __version__ = '$Revision: 1.4 $'.split()[-2:][0]
import sys import sys
import os import os
...@@ -207,11 +207,6 @@ class Autopack(BerkeleyBase): ...@@ -207,11 +207,6 @@ class Autopack(BerkeleyBase):
def iterator(self): def iterator(self):
raise NotImplementedError raise NotImplementedError
def getSize(self):
# Return the size of the pickles table as a rough estimate
filename = os.path.join(self._env.db_home, 'zodb_pickles')
return os.path.getsize(filename)
# Not part of the storage API # Not part of the storage API
def autopack(self): def autopack(self):
......
...@@ -39,7 +39,7 @@ from bsddb3 import db ...@@ -39,7 +39,7 @@ from bsddb3 import db
from ZODB import POSException from ZODB import POSException
from ZODB.BaseStorage import BaseStorage from ZODB.BaseStorage import BaseStorage
__version__ = '$Revision: 1.16 $'.split()[-2:][0] __version__ = '$Revision: 1.17 $'.split()[-2:][0]
...@@ -165,8 +165,9 @@ class BerkeleyBase(BaseStorage): ...@@ -165,8 +165,9 @@ class BerkeleyBase(BaseStorage):
def getSize(self): def getSize(self):
"""Return the size of the database.""" """Return the size of the database."""
# TBD: this is expensive to calculate and many not be necessary. # Return the size of the pickles table as a rough estimate
return 'too hard to determine' filename = os.path.join(self._env.db_home, 'zodb_pickles')
return os.path.getsize(filename)
# BAW: this overrides BaseStorage.tpc_vote() with exactly the same # BAW: this overrides BaseStorage.tpc_vote() with exactly the same
# implementation. This is so Zope 2.3.1, which doesn't include the change # implementation. This is so Zope 2.3.1, which doesn't include the change
......
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