Commit bf7db408 authored by Jim Fulton's avatar Jim Fulton

Got rid of unused error class.

Changed to use keys() rather than items to iterate over
the index.
parent f349b994
...@@ -158,20 +158,17 @@ method:: ...@@ -158,20 +158,17 @@ method::
and call it to minotor the storage. and call it to minotor the storage.
""" """
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import base64, POSException, BTree, BaseStorage, time, string, utils import base64, POSException, BTree, BaseStorage, time, string, utils
from TimeStamp import TimeStamp from TimeStamp import TimeStamp
class DemoStorageError: pass
class MappingStorage(BaseStorage.BaseStorage): class MappingStorage(BaseStorage.BaseStorage):
def __init__(self, name='Mapping Storage'): def __init__(self, name='Mapping Storage'):
BaseStorage.BaseStorage.__init__(self, name) BaseStorage.BaseStorage.__init__(self, name)
# We use a BTree because the items are sorted!
self._index={} self._index={}
self._tindex=[] self._tindex=[]
...@@ -180,7 +177,9 @@ class MappingStorage(BaseStorage.BaseStorage): ...@@ -180,7 +177,9 @@ class MappingStorage(BaseStorage.BaseStorage):
def getSize(self): def getSize(self):
s=32 s=32
for oid, p in self._index.items(): index=self._index
for oid in index.keys():
p=index[oid]
s=s+56+len(p) s=s+56+len(p)
return s return s
...@@ -252,9 +251,11 @@ class MappingStorage(BaseStorage.BaseStorage): ...@@ -252,9 +251,11 @@ class MappingStorage(BaseStorage.BaseStorage):
""" """
o=[] o=[]
o.append('Index:') o.append('Index:')
items=self._index.items() index=self._index
items.sort() keys=index.keys()
for oid, r in items: keys.sort()
for oid in keys:
r=index[oid]
o.append(' %s: %s, %s' % o.append(' %s: %s, %s' %
(utils.u64(oid),TimeStamp(r[:8]),`r[8:]`)) (utils.u64(oid),TimeStamp(r[:8]),`r[8:]`))
......
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