[Neo-report] r2422 vincent - in /trunk/neo/client: Storage.py mq.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sat Nov 6 00:22:53 CET 2010
Author: vincent
Date: Sat Nov 6 00:22:51 2010
New Revision: 2422
Log:
Expose pseudo-API to clear app's cache.
This is used by zodbshootout, for example, to only flush storage's cache.
Modified:
trunk/neo/client/Storage.py
trunk/neo/client/mq.py
Modified: trunk/neo/client/Storage.py
==============================================================================
--- trunk/neo/client/Storage.py [iso-8859-1] (original)
+++ trunk/neo/client/Storage.py [iso-8859-1] Sat Nov 6 00:22:51 2010
@@ -29,6 +29,13 @@ def check_read_only(func):
return func(self, *args, **kw)
return wrapped
+class DummyCache(object):
+ def __init__(self, app):
+ self.app = app
+
+ def clear(self):
+ self.app.mq_cache.clear()
+
class Storage(BaseStorage.BaseStorage,
ConflictResolution.ConflictResolvingStorage):
"""Wrapper class for neoclient."""
@@ -44,6 +51,7 @@ class Storage(BaseStorage.BaseStorage,
self._is_read_only = read_only
self.app = Application(master_nodes, name, connector,
compress=compress)
+ self._cache = DummyCache(self.app)
def load(self, oid, version=None):
try:
Modified: trunk/neo/client/mq.py
==============================================================================
--- trunk/neo/client/mq.py [iso-8859-1] (original)
+++ trunk/neo/client/mq.py [iso-8859-1] Sat Nov 6 00:22:51 2010
@@ -147,16 +147,19 @@ class MQ(object):
def __init__(self, life_time=10000, buffer_levels=9,
max_history_size=100000, max_size=20*1024*1024):
+ self._life_time = life_time
+ self._buffer_levels = buffer_levels
+ self._max_history_size = max_history_size
+ self._max_size = max_size
+ self.clear()
+
+ def clear(self):
self._history_buffer = FIFO()
self._cache_buffers = []
- for level in range(buffer_levels):
+ for level in range(self._buffer_levels):
self._cache_buffers.append(FIFO())
self._data = {}
self._time = 0
- self._life_time = life_time
- self._buffer_levels = buffer_levels
- self._max_history_size = max_history_size
- self._max_size = max_size
self._size = 0
def has_key(self, key):
More information about the Neo-report
mailing list