[Checkins] SVN: gocept.zeoraid/trunk/src/gocept/zeoraid/ test
storage APIs, added method stubs
Thomas Lotze
tl at gocept.com
Tue Jan 8 10:03:25 EST 2008
Log message for revision 82750:
test storage APIs, added method stubs
Changed:
A gocept.zeoraid/trunk/src/gocept/zeoraid/API.txt
U gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
U gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
-=-
Added: gocept.zeoraid/trunk/src/gocept/zeoraid/API.txt
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/API.txt (rev 0)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/API.txt 2008-01-08 15:03:25 UTC (rev 82750)
@@ -0,0 +1,11 @@
+===================================
+Observations on storage API methods
+===================================
+
+sync
+====
+
+ - optionally called by the connection (getattr)
+ - not specified by any interface
+ - what does it do in the first place?
+ - almost nowhere implemented
Property changes on: gocept.zeoraid/trunk/src/gocept/zeoraid/API.txt
___________________________________________________________________
Name: svn:keywords
+ Id Rev Date
Name: svn:eol-style
+ native
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2008-01-08 15:02:47 UTC (rev 82749)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/storage.py 2008-01-08 15:03:25 UTC (rev 82750)
@@ -1,6 +1,10 @@
import threading
import time
+import zope.interface
+
+import ZODB.interfaces
+import ZEO.interfaces
import ZEO.ClientStorage
import ZODB.POSException
import ZODB.utils
@@ -8,6 +12,7 @@
import transaction
+# XXX
def get_serial(storage, oid):
if hasattr(storage, 'lastTid'):
# This is something like a FileStorage
@@ -17,6 +22,7 @@
return get_serial(oid)
+# XXX
def get_last_transaction(storage):
if hasattr(storage, '_zeoraid_lastTransaction'):
last_transaction = storage._zeoraid_lastTransaction()
@@ -43,6 +49,13 @@
"""
+ zope.interface.implements(ZODB.interfaces.IStorage,
+ ZODB.interfaces.IBlobStorage,
+ ZODB.interfaces.IStorageUndoable,
+ ZODB.interfaces.IStorageCurrentRecordIteration,
+ ZEO.interfaces.IServeable,
+ )
+
closed = False
_transaction = None
@@ -157,6 +170,11 @@
assert test1 == test2, "Results not consistent. Asynchronous storage?"
return results[0]
+ # IStorage
+
+ def sortKey(self):
+ return id(self)
+
def isReadOnly(self):
"""
XXX Revisit this approach?
@@ -583,3 +601,28 @@
raise RAIDClosedError("Storage has been closed.")
self._degrade_storage(name, fail=False)
return 'disabled %r' % name
+
+ # IBlobStorage
+
+ def storeBlob(self, oid, oldserial, data, blob, version, transaction):
+ """Stores data that has a BLOB attached."""
+ # XXX
+
+ def loadBlob(self, oid, serial):
+ """Return the filename of the Blob data for this OID and serial."""
+ # XXX
+
+ def temporaryDirectory(self):
+ """Return a directory that should be used for uncommitted blob data.
+ """
+ # XXX
+
+ # IStorageCurrentRecordIteration
+
+ def record_iternext(self, next=None):
+ """Iterate over the records in a storage."""
+
+ # IServeable
+
+ def lastInvalidations(self, size):
+ """Get recent transaction invalidations."""
Modified: gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py 2008-01-08 15:02:47 UTC (rev 82749)
+++ gocept.zeoraid/trunk/src/gocept/zeoraid/tests/test_basics.py 2008-01-08 15:03:25 UTC (rev 82750)
@@ -2,6 +2,8 @@
import tempfile
import os
+import zope.interface.verify
+
from ZODB.tests import StorageTestBase, BasicStorage, \
TransactionalUndoStorage, VersionStorage, \
TransactionalUndoVersionStorage, PackableStorage, \
@@ -17,7 +19,10 @@
from ZEO.tests import forker, CommitLockTests, ThreadTests
from ZEO.tests.testZEO import get_port
+import ZODB.interfaces
+import ZEO.interfaces
+
class DemoOpener(object):
class_ = FileStorage
@@ -109,9 +114,18 @@
MTStorage.MTStorage,
ReadOnlyStorage.ReadOnlyStorage,
):
- pass
+ def check_raid_interfaces(self):
+ for iface in (ZODB.interfaces.IStorage,
+ ZODB.interfaces.IBlobStorage,
+ ZODB.interfaces.IStorageUndoable,
+ ZODB.interfaces.IStorageCurrentRecordIteration,
+ ZEO.interfaces.IServeable,
+ ):
+ self.assert_(zope.interface.verify.verifyObject(iface,
+ self._storage))
+
class FSReplicationStorageTests(FileStorageBackendTests,
ReplicationStorageTests):
pass
More information about the Checkins
mailing list