Commit 8d74bdb4 authored by Vincent Pelletier's avatar Vincent Pelletier

Provide IStorage.

Also, some manual tweaks to fix easy differences between implementation and
interface / related comments:
- make name unique (provided name option is itself unique)
- __name__ property definition is delegated to BaseStorage.__init__
- warn about _is_read_only as being somewhat part of the interface
- make "load"'s "version" mandatory, and assert it is ''
- store: likewise
- registerDB shouldn't require a second argument
- note that tpc_begin doesn't follow interface described behaviour when
  a commit is already running. This is a feature actually, and should be
  harmless to caller.

git-svn-id: 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent aa4a267f
......@@ -16,6 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from ZODB import BaseStorage, ConflictResolution, POSException
from zope.interface import implements
import ZODB.interfaces
from neo import setupLog
from import Application
......@@ -40,20 +42,24 @@ class Storage(BaseStorage.BaseStorage,
"""Wrapper class for neoclient."""
__name__ = 'NEOStorage'
def __init__(self, master_nodes, name, connector=None, read_only=False,
compress=None, logfile=None, verbose=False, **kw):
if compress is None:
compress = True
setupLog('CLIENT', filename=logfile, verbose=verbose)
BaseStorage.BaseStorage.__init__(self, name)
BaseStorage.BaseStorage.__init__(self, 'NEOStorage(%s)' % (name, ))
# Warning: _is_read_only is used in BaseStorage, do not rename it.
self._is_read_only = read_only = Application(master_nodes, name, connector,
self._cache = DummyCache(
def load(self, oid, version=None):
def load(self, oid, version):
assert version == '', 'Versions are not supported'
except NEOStorageNotFoundError:
......@@ -65,6 +71,9 @@ class Storage(BaseStorage.BaseStorage,
def tpc_begin(self, transaction, tid=None, status=' '):
Note: never blocks in NEO.
return, tid=tid,
......@@ -83,6 +92,7 @@ class Storage(BaseStorage.BaseStorage,
def store(self, oid, serial, data, version, transaction):
assert version == '', 'Versions are not supported'
return, serial=serial,
data=data, version=version, transaction=transaction)
......@@ -143,7 +153,7 @@ class Storage(BaseStorage.BaseStorage,
def __len__(self):
def registerDB(self, db, limit):
def registerDB(self, db, limit=None):, limit)
def history(self, oid, version=None, size=1, filter=None):
......@@ -293,7 +293,7 @@ class ClientTests(NEOFunctionalTest):
t3.description = 'desc'
# retreive the last revision
data, serial = st3.load(oid)
data, serial = st3.load(oid, '')
# try to store again, should not be delayed, serial, data, '', t3)
# the vote should not timeout
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