Commit 13ed7e95 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove an XX about storage size accessor. Implement a basic and inaccurate

solution and add a TODO entry to do a better job later.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@999 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bbd093e3
......@@ -130,3 +130,4 @@ RC Known bugs
- Consider storing some metadata on master nodes (partition table [version], ...). This data should be treated non-authoritatively, as a way to lower the probability to use an outdated partition table.
- Decentralize primary master tasks as much as possible (consider distributed lock mechanisms, ...)
- Make admin node able to monitor multiple clusters simultaneously
- Choose how to compute the storage size
......@@ -160,8 +160,7 @@ class Storage(BaseStorage.BaseStorage,
raise NotImplementedError
def __len__(self):
# XXX bogus but how to implement this?
return 0
return self.app.getStorageSize()
def registerDB(self, db, limit):
self.app.registerDB(db, limit)
......
......@@ -269,6 +269,7 @@ class Application(object):
self.mq_cache = MQ()
self.new_oid_list = []
self.ptid = None
self.last_oid = '\0' * 8
self.storage_event_handler = storage.StorageEventHandler(self, self.dispatcher)
self.storage_bootstrap_handler = storage.StorageBootstrapHandler(self)
self.storage_handler = storage.StorageAnswersHandler(self)
......@@ -518,10 +519,15 @@ class Application(object):
self._askPrimary(protocol.askNewOIDs(100))
if len(self.new_oid_list) <= 0:
raise NEOStorageError('new_oid failed')
return self.new_oid_list.pop()
self.last_oid = self.new_oid_list.pop()
return self.last_oid
finally:
self._oid_lock_release()
def getStorageSize(self):
# return the last OID used, this is innacurate
from neo.util import u64
return int(u64(self.last_oid))
def getSerial(self, oid):
# Try in cache first
......
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