Commit 60fe92fe authored by Jim Fulton's avatar Jim Fulton

Move the load method from IStorage to IMVCCStorage

And finally get rid of the version argument.

Also drop the version argument from IStorageWrapper.invalidate.
parent 965bf84a
......@@ -230,7 +230,7 @@ class Connection(ExportImport, object):
if obj is not None:
return obj
p, _ = self._storage.load(oid, '')
p, _ = self._storage.load(oid)
obj = self._reader.getGhost(p)
# Avoid infiniate loop if obj tries to load its state before
......@@ -755,7 +755,7 @@ class Connection(ExportImport, object):
raise
try:
p, serial = self._storage.load(oid, '')
p, serial = self._storage.load(oid)
self._load_count += 1
......@@ -1100,7 +1100,7 @@ class TmpStore:
def load(self, oid, version=''):
pos = self.index.get(oid)
if pos is None:
return self._storage.load(oid, '')
return self._storage.load(oid)
self._file.seek(pos)
h = self._file.read(8)
oidlen = u64(h)
......
......@@ -448,7 +448,7 @@ class DB(object):
try:
try:
temp_storage.poll_invalidations()
temp_storage.load(z64, '')
temp_storage.load(z64)
except KeyError:
# Create the database's root in the storage if it doesn't exist
from persistent.mapping import PersistentMapping
......
......@@ -313,7 +313,7 @@ class IStorageWrapper(Interface):
there would be so many that it would be inefficient to do so.
"""
def invalidate(transaction_id, oids, version=''):
def invalidate(transaction_id, oids):
"""Invalidate object ids committed by the given transaction
The oids argument is an iterable of object identifiers.
......@@ -551,34 +551,6 @@ class IStorage(Interface):
This is used soley for informational purposes.
"""
def load(oid, version):
"""Load data for an object id
NOTE: This method is deprecated and may be removed in the
future. It is no longer used by ZODB, although it may still
be used in some tests or scripts. Previously, there was a
requirement that load results be properly ordered with
invalidations so that at any point in time, clients have a
consistent view of what version of an object is current. This
restriction has been relaxed and some storages will be
simplified as a result of the removal of this requirement.
An alternative to calling load is calling loadBefore passing
ZODB.utils.maxtid::
store.loadBefore(oid, ZODB.utils.maxtid)
The version argumement should always be an empty string. It
exists soley for backward compatibility with older storage
implementations.
A data record and serial are returned. The serial is a
transaction identifier of the transaction that wrote the data
record.
A POSKeyError is raised if there is no record for the object id.
"""
def loadBefore(oid, tid):
"""Load the object data written before a transaction id
......@@ -1094,6 +1066,16 @@ class IMVCCStorage(IStorage):
the frequency of database polls, thus reducing database load.
"""
def load(oid):
"""Load current data for an object id
A data record and serial are returned. The serial is a
transaction identifier of the transaction that wrote the data
record.
A POSKeyError is raised if there is no record for the object id.
"""
class IStorageCurrentRecordIteration(IStorage):
......
......@@ -75,7 +75,7 @@ class MVCCAdapter(Base):
for instance in self._instances:
instance._invalidateCache()
def invalidate(self, transaction_id, oids, version=''):
def invalidate(self, transaction_id, oids):
with self._lock:
for instance in self._instances:
instance._invalidate(oids)
......
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