Commit 2722e047 authored by Guido van Rossum's avatar Guido van Rossum

More changes merging the StandaloneZODB-1.0 release branch into the

trunk.  I'm *almost* done with the merge; the only file not yet merged
is FileStorage.py.
parent f63b9e1e
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Berkeley storage with full undo and versioning support. """Berkeley storage with full undo and versioning support.
See Minimal.py for an implementation of Berkeley storage that does not support See Minimal.py for an implementation of Berkeley storage that does not support
undo or versioning. undo or versioning.
""" """
__version__ = '$Revision: 1.38 $'.split()[-2:][0] __version__ = '$Revision: 1.39 $'.split()[-2:][0]
import sys import sys
import struct import struct
...@@ -593,9 +607,7 @@ class Full(BerkeleyBase, ConflictResolvingStorage): ...@@ -593,9 +607,7 @@ class Full(BerkeleyBase, ConflictResolvingStorage):
if data: if data:
conflictresolved = 1 conflictresolved = 1
else: else:
raise POSException.ConflictError( raise POSException.ConflictError(serials=(oserial, serial))
'serial number mismatch (was: %s, has: %s)' %
(U64(oserial), serial and U64(serial)))
# Do we already know about this version? If not, we need to # Do we already know about this version? If not, we need to
# record the fact that a new version is being created. `version' # record the fact that a new version is being created. `version'
# will be the empty string when the transaction is storing on the # will be the empty string when the transaction is storing on the
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Berkeley storage without undo or versioning. """Berkeley storage without undo or versioning.
See Full.py for an implementation of Berkeley storage that does support undo See Full.py for an implementation of Berkeley storage that does support undo
and versioning. and versioning.
""" """
__version__ = '$Revision: 1.11 $'[-2:][0] __version__ = '$Revision: 1.12 $'[-2:][0]
# This uses the Dunn/Kuchling PyBSDDB v3 extension module available from # This uses the Dunn/Kuchling PyBSDDB v3 extension module available from
# http://pybsddb.sourceforge.net. It is compatible with release 3.0 of # http://pybsddb.sourceforge.net. It is compatible with release 3.0 of
...@@ -176,8 +190,7 @@ class Minimal(BerkeleyBase): ...@@ -176,8 +190,7 @@ class Minimal(BerkeleyBase):
# given in the call is not the same as the last stored serial # given in the call is not the same as the last stored serial
# number. Raise a ConflictError. # number. Raise a ConflictError.
raise POSException.ConflictError( raise POSException.ConflictError(
'serial number mismatch (was: %s, has: %s)' % serials=(oserial, serial))
(utils.U64(oserial), utils.U64(serial)))
# Our serial number is updated in BaseStorage's tpc_begin() call, # Our serial number is updated in BaseStorage's tpc_begin() call,
# which sets the serial number to the current timestamp. # which sets the serial number to the current timestamp.
serial = self._serial serial = self._serial
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Berkeley storage with full undo and versioning support. """Berkeley storage with full undo and versioning support.
See Minimal.py for an implementation of Berkeley storage that does not support See Minimal.py for an implementation of Berkeley storage that does not support
undo or versioning. undo or versioning.
""" """
__version__ = '$Revision: 1.38 $'.split()[-2:][0] __version__ = '$Revision: 1.39 $'.split()[-2:][0]
import sys import sys
import struct import struct
...@@ -593,9 +607,7 @@ class Full(BerkeleyBase, ConflictResolvingStorage): ...@@ -593,9 +607,7 @@ class Full(BerkeleyBase, ConflictResolvingStorage):
if data: if data:
conflictresolved = 1 conflictresolved = 1
else: else:
raise POSException.ConflictError( raise POSException.ConflictError(serials=(oserial, serial))
'serial number mismatch (was: %s, has: %s)' %
(U64(oserial), serial and U64(serial)))
# Do we already know about this version? If not, we need to # Do we already know about this version? If not, we need to
# record the fact that a new version is being created. `version' # record the fact that a new version is being created. `version'
# will be the empty string when the transaction is storing on the # will be the empty string when the transaction is storing on the
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Berkeley storage without undo or versioning. """Berkeley storage without undo or versioning.
See Full.py for an implementation of Berkeley storage that does support undo See Full.py for an implementation of Berkeley storage that does support undo
and versioning. and versioning.
""" """
__version__ = '$Revision: 1.11 $'[-2:][0] __version__ = '$Revision: 1.12 $'[-2:][0]
# This uses the Dunn/Kuchling PyBSDDB v3 extension module available from # This uses the Dunn/Kuchling PyBSDDB v3 extension module available from
# http://pybsddb.sourceforge.net. It is compatible with release 3.0 of # http://pybsddb.sourceforge.net. It is compatible with release 3.0 of
...@@ -176,8 +190,7 @@ class Minimal(BerkeleyBase): ...@@ -176,8 +190,7 @@ class Minimal(BerkeleyBase):
# given in the call is not the same as the last stored serial # given in the call is not the same as the last stored serial
# number. Raise a ConflictError. # number. Raise a ConflictError.
raise POSException.ConflictError( raise POSException.ConflictError(
'serial number mismatch (was: %s, has: %s)' % serials=(oserial, serial))
(utils.U64(oserial), utils.U64(serial)))
# Our serial number is updated in BaseStorage's tpc_begin() call, # Our serial number is updated in BaseStorage's tpc_begin() call,
# which sets the serial number to the current timestamp. # which sets the serial number to the current timestamp.
serial = self._serial serial = self._serial
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from base import Base from base import Base
from bsddb3 import db from bsddb3 import db
from struct import pack, unpack from struct import pack, unpack
...@@ -28,7 +42,8 @@ class Minimal(Base): ...@@ -28,7 +42,8 @@ class Minimal(Base):
try: try:
if self._index.has_key(oid): if self._index.has_key(oid):
oserial=self._index[oid] oserial=self._index[oid]
if serial != oserial: raise POSException.ConflictError if serial != oserial:
raise POSException.ConflictError(serials=(oserial, serial))
serial=self._serial serial=self._serial
self._tmp.write(oid+pack(">I", len(data))) self._tmp.write(oid+pack(">I", len(data)))
......
...@@ -11,13 +11,14 @@ ...@@ -11,13 +11,14 @@
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
""" """
An implementation of a BerkeleyDB-backed storage that uses a reference- An implementation of a BerkeleyDB-backed storage that uses a reference-
counting garbage-collection strategy which necessitates packing only when counting garbage-collection strategy which necessitates packing only when
the stored data has cyclically-referenced garbage. the stored data has cyclically-referenced garbage.
""" """
__version__ ='$Revision: 1.6 $'[11:-2] __version__ ='$Revision: 1.7 $'[11:-2]
from base import Base, DBError from base import Base, DBError
from base import BerkeleyDBError from base import BerkeleyDBError
...@@ -84,7 +85,8 @@ class Packless(Base): ...@@ -84,7 +85,8 @@ class Packless(Base):
try: try:
if self._index.has_key(oid): if self._index.has_key(oid):
oserial=self._index[oid] oserial=self._index[oid]
if serial != oserial: raise POSException.ConflictError if serial != oserial:
raise POSException.ConflictError(serials=(oserial, serial))
serial=self._serial serial=self._serial
try: try:
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
# Unit tests for basic storage functionality # Unit tests for basic storage functionality
import unittest import unittest
......
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