Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
b36489aa
Commit
b36489aa
authored
Jun 06, 2007
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- style cleanups
parent
1e863cd1
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
135 additions
and
140 deletions
+135
-140
src/ZODB/FileStorage/FileStorage.py
src/ZODB/FileStorage/FileStorage.py
+6
-5
src/ZODB/FileStorage/__init__.py
src/ZODB/FileStorage/__init__.py
+2
-2
src/ZODB/FileStorage/fspack.py
src/ZODB/FileStorage/fspack.py
+2
-3
src/ZODB/fstools.py
src/ZODB/fstools.py
+2
-2
src/ZODB/interfaces.py
src/ZODB/interfaces.py
+4
-4
src/ZODB/scripts/migrate.py
src/ZODB/scripts/migrate.py
+4
-4
src/ZODB/serialize.py
src/ZODB/serialize.py
+3
-3
src/ZODB/tests/BasicStorage.py
src/ZODB/tests/BasicStorage.py
+2
-2
src/ZODB/tests/MTStorage.py
src/ZODB/tests/MTStorage.py
+2
-2
src/ZODB/tests/RevisionStorage.py
src/ZODB/tests/RevisionStorage.py
+2
-2
src/ZODB/tests/testBroken.py
src/ZODB/tests/testBroken.py
+4
-4
src/ZODB/tests/testConnection.py
src/ZODB/tests/testConnection.py
+56
-58
src/ZODB/tests/testDB.py
src/ZODB/tests/testDB.py
+36
-38
src/ZODB/tests/testFileStorage.py
src/ZODB/tests/testFileStorage.py
+6
-6
src/ZODB/tests/testMappingStorage.py
src/ZODB/tests/testMappingStorage.py
+2
-2
src/ZODB/tests/test_storage.py
src/ZODB/tests/test_storage.py
+2
-3
No files found.
src/ZODB/FileStorage/FileStorage.py
View file @
b36489aa
...
@@ -30,15 +30,16 @@ from struct import pack, unpack
...
@@ -30,15 +30,16 @@ from struct import pack, unpack
fsync
=
getattr
(
os
,
"fsync"
,
None
)
fsync
=
getattr
(
os
,
"fsync"
,
None
)
from
ZODB
import
BaseStorage
,
ConflictResolution
,
POSException
from
ZODB
import
BaseStorage
,
ConflictResolution
,
POSException
from
ZODB.POSException
\
from
ZODB.POSException
import
UndoError
,
POSKeyError
,
MultipleUndoErrors
import
UndoError
,
POSKeyError
,
MultipleUndoErrors
,
VersionLockError
from
ZODB.POSException
import
VersionLockError
from
persistent.TimeStamp
import
TimeStamp
from
persistent.TimeStamp
import
TimeStamp
from
ZODB.lock_file
import
LockFile
from
ZODB.lock_file
import
LockFile
from
ZODB.utils
import
p64
,
u64
,
cp
,
z64
from
ZODB.utils
import
p64
,
u64
,
cp
,
z64
from
ZODB.FileStorage.fspack
import
FileStoragePacker
from
ZODB.FileStorage.fspack
import
FileStoragePacker
from
ZODB.FileStorage.format
\
from
ZODB.FileStorage.format
import
FileStorageFormatter
,
DataHeader
import
FileStorageFormatter
,
DataHeader
,
TxnHeader
,
DATA_HDR
,
\
from
ZODB.FileStorage.format
import
TxnHeader
,
DATA_HDR
,
DATA_HDR_LEN
DATA_HDR_LEN
,
TRANS_HDR
,
TRANS_HDR_LEN
,
CorruptedDataError
from
ZODB.FileStorage.format
import
TRANS_HDR
,
TRANS_HDR_LEN
from
ZODB.FileStorage.format
import
CorruptedDataError
from
ZODB.loglevels
import
BLATHER
from
ZODB.loglevels
import
BLATHER
from
ZODB.fsIndex
import
fsIndex
from
ZODB.fsIndex
import
fsIndex
...
...
src/ZODB/FileStorage/__init__.py
View file @
b36489aa
# this is a package
# this is a package
from
ZODB.FileStorage.FileStorage
\
from
ZODB.FileStorage.FileStorage
import
FileStorage
,
RecordIterator
import
FileStorage
,
RecordIterator
,
FileIterator
,
Record
,
packed_version
from
ZODB.FileStorage.FileStorage
import
FileIterator
,
Record
,
packed_version
src/ZODB/FileStorage/fspack.py
View file @
b36489aa
...
@@ -30,9 +30,8 @@ from ZODB.serialize import referencesf
...
@@ -30,9 +30,8 @@ from ZODB.serialize import referencesf
from
ZODB.utils
import
p64
,
u64
,
z64
from
ZODB.utils
import
p64
,
u64
,
z64
from
ZODB.fsIndex
import
fsIndex
from
ZODB.fsIndex
import
fsIndex
from
ZODB.FileStorage.format
\
from
ZODB.FileStorage.format
import
FileStorageFormatter
,
CorruptedDataError
import
FileStorageFormatter
,
CorruptedDataError
,
DataHeader
,
\
from
ZODB.FileStorage.format
import
DataHeader
,
TRANS_HDR_LEN
TRANS_HDR_LEN
class
DataCopier
(
FileStorageFormatter
):
class
DataCopier
(
FileStorageFormatter
):
"""Mixin class for copying transactions into a storage.
"""Mixin class for copying transactions into a storage.
...
...
src/ZODB/fstools.py
View file @
b36489aa
...
@@ -21,8 +21,8 @@ Caution: This file needs to be kept in sync with FileStorage.py.
...
@@ -21,8 +21,8 @@ Caution: This file needs to be kept in sync with FileStorage.py.
import
cPickle
import
cPickle
import
struct
import
struct
from
ZODB.FileStorage.format
import
TRANS_HDR
,
DATA_HDR
,
TRANS_HDR_LEN
,
\
from
ZODB.FileStorage.format
import
TRANS_HDR
,
DATA_HDR
,
TRANS_HDR_LEN
DATA_HDR_LEN
,
DATA_VERSION_HDR_LEN
from
ZODB.FileStorage.format
import
DATA_HDR_LEN
,
DATA_VERSION_HDR_LEN
from
ZODB.utils
import
u64
from
ZODB.utils
import
u64
from
persistent.TimeStamp
import
TimeStamp
from
persistent.TimeStamp
import
TimeStamp
...
...
src/ZODB/interfaces.py
View file @
b36489aa
...
@@ -230,8 +230,8 @@ class IConnection(Interface):
...
@@ -230,8 +230,8 @@ class IConnection(Interface):
# Multi-database support.
# Multi-database support.
connections
=
Attribute
(
"""
\
connections
=
Attribute
(
A mapping from database name to a Connection to that database.
"""
A mapping from database name to a Connection to that database.
In multi-database use, the Connections of all members of a database
In multi-database use, the Connections of all members of a database
collection share the same .connections object.
collection share the same .connections object.
...
@@ -345,8 +345,8 @@ class IDatabase(IStorageDB):
...
@@ -345,8 +345,8 @@ class IDatabase(IStorageDB):
TODO: This interface is incomplete.
TODO: This interface is incomplete.
"""
"""
databases
=
Attribute
(
"""
\
databases
=
Attribute
(
A mapping from database name to DB (database) object.
"""
A mapping from database name to DB (database) object.
In multi-database use, all DB members of a database collection share
In multi-database use, all DB members of a database collection share
the same .databases object.
the same .databases object.
...
...
src/ZODB/scripts/migrate.py
View file @
b36489aa
...
@@ -258,16 +258,16 @@ def doit(srcdb, dstdb, options):
...
@@ -258,16 +258,16 @@ def doit(srcdb, dstdb, options):
t = TimeStamp(tid)
t = TimeStamp(tid)
if t <= ts:
if t <= ts:
if ok:
if ok:
print >> sys.stderr,
\
print >> sys.stderr,
(
'
Time
stamps
are
out
of
order
%
s
,
%
s
' % (ts, t
)
'
Time
stamps
are
out
of
order
%
s
,
%
s
' % (ts, t)
)
ok = False
ok = False
ts = t.laterThan(ts)
ts = t.laterThan(ts)
tid = `ts`
tid = `ts`
else:
else:
ts = t
ts = t
if not ok:
if not ok:
print >> sys.stderr,
\
print >> sys.stderr,
(
'
Time
stamps
are
back
in
order
%
s
' % t
'
Time
stamps
are
back
in
order
%
s
' % t)
ok = True
ok = True
if verbose > 1:
if verbose > 1:
print ts
print ts
...
...
src/ZODB/serialize.py
View file @
b36489aa
...
@@ -229,11 +229,11 @@ class ObjectWriter:
...
@@ -229,11 +229,11 @@ class ObjectWriter:
If the jar doesn't match that of the writer, an error is raised:
If the jar doesn't match that of the writer, an error is raised:
>>> bob._p_jar = DummyJar()
>>> bob._p_jar = DummyJar()
>>> writer.persistent_id(bob)
>>> writer.persistent_id(bob)
# doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
Traceback (most recent call last):
...
...
InvalidObjectReference: Attempt to store an object from a
"""
\
InvalidObjectReference: Attempt to store an object from a
"""
foreign database connection
foreign database connection
Constructor arguments used by __new__(), as returned by
Constructor arguments used by __new__(), as returned by
__getnewargs__(), can affect memory allocation, but may also
__getnewargs__(), can affect memory allocation, but may also
...
...
src/ZODB/tests/BasicStorage.py
View file @
b36489aa
...
@@ -21,8 +21,8 @@ All storages should be able to pass these tests.
...
@@ -21,8 +21,8 @@ All storages should be able to pass these tests.
from
ZODB
import
POSException
from
ZODB
import
POSException
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
\
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
,
zodb_pickle
import
zodb_unpickle
,
zodb_pickle
,
handle_serials
from
ZODB.tests.StorageTestBase
import
handle_serials
import
transaction
import
transaction
...
...
src/ZODB/tests/MTStorage.py
View file @
b36489aa
...
@@ -7,8 +7,8 @@ from persistent.mapping import PersistentMapping
...
@@ -7,8 +7,8 @@ from persistent.mapping import PersistentMapping
import
transaction
import
transaction
import
ZODB
import
ZODB
from
ZODB.tests.StorageTestBase
\
from
ZODB.tests.StorageTestBase
import
zodb_pickle
,
zodb_unpickle
import
zodb_pickle
,
zodb_unpickle
,
handle_serials
from
ZODB.tests.StorageTestBase
import
handle_serials
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
...
...
src/ZODB/tests/RevisionStorage.py
View file @
b36489aa
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
"""Check loadSerial() on storages that support historical revisions."""
"""Check loadSerial() on storages that support historical revisions."""
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
\
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
,
zodb_pickle
,
snooze
zodb_unpickle
,
zodb_pickle
,
snooze
,
handle_serials
from
ZODB.tests.StorageTestBase
import
handle_serials
from
ZODB.utils
import
p64
,
u64
from
ZODB.utils
import
p64
,
u64
import
transaction
import
transaction
...
...
src/ZODB/tests/testBroken.py
View file @
b36489aa
...
@@ -24,7 +24,7 @@ from zope.testing.doctest import DocTestSuite
...
@@ -24,7 +24,7 @@ from zope.testing.doctest import DocTestSuite
from
ZODB.tests.util
import
DB
from
ZODB.tests.util
import
DB
def
test_integration
():
def
test_integration
():
"""Test the integration of broken object support with the databse:
r
"""Test the integration of broken object support with the databse:
>>> db = DB()
>>> db = DB()
...
@@ -64,9 +64,9 @@ def test_integration():
...
@@ -64,9 +64,9 @@ def test_integration():
>>> conn3 = db.open()
>>> conn3 = db.open()
>>> a3 = conn3.root()['a']
>>> a3 = conn3.root()['a']
>>> a3
>>> a3
# doctest: +NORMALIZE_WHITESPACE
<persistent broken ZODB.not.there.Atall instance
"""
\
<persistent broken ZODB.not.there.Atall instance
r"""
'\x00\x00\x00\x00\x00\x00\x00\x01'>
'\x00\x00\x00\x00\x00\x00\x00\x01'>
>>> a3.__Broken_state__
>>> a3.__Broken_state__
{'x': 1}
{'x': 1}
...
...
src/ZODB/tests/testConnection.py
View file @
b36489aa
...
@@ -444,77 +444,75 @@ class InvalidationTests(unittest.TestCase):
...
@@ -444,77 +444,75 @@ class InvalidationTests(unittest.TestCase):
"""
"""
def
test_invalidateCache
():
def
test_invalidateCache
():
"""
\
"""The invalidateCache method invalidates a connection's cache. It also
prevents reads until the end of a transaction::
The invalidateCache method invalidates a connection's cache. It also
>>> from ZODB.tests.util import DB
prevents reads until the end of a transaction.
>>> import transaction
>>> db = DB()
>>> from ZODB.tests.util import DB
>>> tm = transaction.TransactionManager()
>>> import transaction
>>> connection = db.open(transaction_manager=tm)
>>> db = DB()
>>> connection.root()['a'] = StubObject()
>>> tm = transaction.TransactionManager()
>>> connection.root()['a'].x = 1
>>> connection = db.open(transaction_manager=tm)
>>> connection.root()['b'] = StubObject()
>>> connection.root()['a'] = StubObject()
>>> connection.root()['b'].x = 1
>>> connection.root()['a'].x = 1
>>> connection.root()['c'] = StubObject()
>>> connection.root()['b'] = StubObject()
>>> connection.root()['c'].x = 1
>>> connection.root()['b'].x = 1
>>> tm.commit()
>>> connection.root()['c'] = StubObject()
>>> connection.root()['b']._p_deactivate()
>>> connection.root()['c'].x = 1
>>> connection.root()['c'].x = 2
>>> tm.commit()
>>> connection.root()['b']._p_deactivate()
So we have a connection and an active transaction with some modifications.
>>> connection.root()['c'].x = 2
Lets call invalidateCache:
So we have a connection and an active transaction with some
>>> connection.invalidateCache()
modifications. Lets call invalidateCache:
Now, if we try to load an object, we'll get a read conflict:
>>> connection.invalidateCache()
>>> connection.root()['b'].x
Now, if we try to load an object, we'll get a read conflict:
Traceback (most recent call last):
...
ReadConflictError: database read conflict error
>>> connection.root()['b'].x
If we try to commit the transaction, we'll get a conflict error:
Traceback (most recent call last):
...
ReadConflictError: database read conflict error
If we try to commit the transaction, we'll get a conflict error:
>>> tm.commit()
Traceback (most recent call last):
...
ConflictError: database conflict error
>>> tm.commit()
and the cache will have been cleared:
Traceback (most recent call last):
...
ConflictError: database conflict error
and the cache will have been cleared:
>>> print connection.root()['a']._p_changed
None
>>> print connection.root()['b']._p_changed
None
>>> print connection.root()['c']._p_changed
None
>>> print connection.root()['a']._p_changed
But we'll be able to access data again:
None
>>> print connection.root()['b']._p_changed
None
>>> print connection.root()['c']._p_changed
None
But we'll be able to access data again:
>>> connection.root()['b'].x
1
>>> connection.root()['b'].x
Aborting a transaction after a read conflict also lets us read data and go
1
on about our business:
Aborting a transaction after a read conflict also lets us read data
>>> connection.invalidateCache()
and go on about our business:
>>> connection.invalidateCache()
>>> connection.root()['c'].x
>>> connection.root()['c'].x
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ReadConflictError: database read conflict error
ReadConflictError: database read conflict error
>>> tm.abort()
>>> tm.abort()
>>> connection.root()['c'].x
>>> connection.root()['c'].x
1
1
>>> connection.root()['c'].x = 2
>>> connection.root()['c'].x = 2
>>> tm.commit()
>>> tm.commit()
>>> db.close()
>>> db.close()
"""
"""
# ---- stubs
# ---- stubs
...
...
src/ZODB/tests/testDB.py
View file @
b36489aa
...
@@ -143,47 +143,45 @@ class DBTests(unittest.TestCase):
...
@@ -143,47 +143,45 @@ class DBTests(unittest.TestCase):
def
test_invalidateCache
():
def
test_invalidateCache
():
"""
\
"""The invalidateCache method invalidates a connection caches for all of
the connections attached to a database::
The invalidateCache method invalidates a connection caches for all of the connections attached to a database.
>>> from ZODB.tests.util import DB
>>> from ZODB.tests.util import DB
>>> import transaction
>>> import transaction
>>> db = DB()
>>> db = DB()
>>> tm1 = transaction.TransactionManager()
>>> tm1 = transaction.TransactionManager()
>>> c1 = db.open(transaction_manager=tm1)
>>> c1 = db.open(transaction_manager=tm1)
>>> c1.root()['a'] = MinPO(1)
>>> c1.root()['a'] = MinPO(1)
>>> tm1.commit()
>>> tm1.commit()
>>> tm2 = transaction.TransactionManager()
>>> tm2 = transaction.TransactionManager()
>>> c2 = db.open(transaction_manager=tm2)
>>> c2 = db.open(transaction_manager=tm2)
>>> c1.root()['a']._p_deactivate()
>>> c1.root()['a']._p_deactivate()
>>> tm3 = transaction.TransactionManager()
>>> tm3 = transaction.TransactionManager()
>>> c3 = db.open(transaction_manager=tm3)
>>> c3 = db.open(transaction_manager=tm3)
>>> c3.root()['a'].value
>>> c3.root()['a'].value
1
1
>>> c3.close()
>>> c3.close()
>>> db.invalidateCache()
>>> db.invalidateCache()
>>> c1.root()['a'].value
>>> c1.root()['a'].value
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ReadConflictError: database read conflict error
ReadConflictError: database read conflict error
>>> c2.root()['a'].value
>>> c2.root()['a'].value
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ReadConflictError: database read conflict error
ReadConflictError: database read conflict error
>>> c3 is db.open(transaction_manager=tm3)
>>> c3 is db.open(transaction_manager=tm3)
True
True
>>> print c3.root()['a']._p_changed
>>> print c3.root()['a']._p_changed
None
None
>>> db.close()
>>> db.close()
"""
"""
def
test_suite
():
def
test_suite
():
s
=
unittest
.
makeSuite
(
DBTests
)
s
=
unittest
.
makeSuite
(
DBTests
)
s
.
addTest
(
doctest
.
DocTestSuite
())
s
.
addTest
(
doctest
.
DocTestSuite
())
...
...
src/ZODB/tests/testFileStorage.py
View file @
b36489aa
...
@@ -18,12 +18,12 @@ import ZODB.tests.util
...
@@ -18,12 +18,12 @@ import ZODB.tests.util
from
ZODB
import
POSException
from
ZODB
import
POSException
from
ZODB
import
DB
from
ZODB
import
DB
from
ZODB.tests
import
StorageTestBase
,
BasicStorage
,
\
from
ZODB.tests
import
StorageTestBase
,
BasicStorage
,
TransactionalUndoStorage
TransactionalUndoStorage
,
VersionStorage
,
\
from
ZODB.tests
import
VersionStorage
,
TransactionalUndoVersionStorage
TransactionalUndoVersionStorage
,
PackableStorage
,
\
from
ZODB.tests
import
PackableStorage
,
Synchronization
,
ConflictResolution
Synchronization
,
ConflictResolution
,
HistoryStorage
,
\
from
ZODB.tests
import
HistoryStorage
,
IteratorStorage
,
Corruption
IteratorStorage
,
Corruption
,
RevisionStorage
,
PersistentStorage
,
\
from
ZODB.tests
import
RevisionStorage
,
PersistentStorage
,
MTStorage
MTStorage
,
ReadOnlyStorage
,
RecoveryStorage
from
ZODB.tests
import
ReadOnlyStorage
,
RecoveryStorage
from
ZODB.tests.StorageTestBase
import
MinPO
,
zodb_pickle
from
ZODB.tests.StorageTestBase
import
MinPO
,
zodb_pickle
class
BaseFileStorageTests
(
StorageTestBase
.
StorageTestBase
):
class
BaseFileStorageTests
(
StorageTestBase
.
StorageTestBase
):
...
...
src/ZODB/tests/testMappingStorage.py
View file @
b36489aa
...
@@ -15,8 +15,8 @@ import ZODB.MappingStorage
...
@@ -15,8 +15,8 @@ import ZODB.MappingStorage
import
unittest
import
unittest
from
ZODB.tests
import
StorageTestBase
from
ZODB.tests
import
StorageTestBase
from
ZODB.tests
\
from
ZODB.tests
import
BasicStorage
,
MTStorage
,
Synchronization
import
BasicStorage
,
MTStorage
,
Synchronization
,
PackableStorage
from
ZODB.tests
import
PackableStorage
class
MappingStorageTests
(
StorageTestBase
.
StorageTestBase
,
class
MappingStorageTests
(
StorageTestBase
.
StorageTestBase
,
BasicStorage
.
BasicStorage
,
BasicStorage
.
BasicStorage
,
...
...
src/ZODB/tests/test_storage.py
View file @
b36489aa
...
@@ -28,9 +28,8 @@ from ZODB import POSException
...
@@ -28,9 +28,8 @@ from ZODB import POSException
from
ZODB.utils
import
z64
from
ZODB.utils
import
z64
from
ZODB.tests
import
StorageTestBase
from
ZODB.tests
import
StorageTestBase
from
ZODB.tests
\
from
ZODB.tests
import
BasicStorage
,
MTStorage
,
Synchronization
import
BasicStorage
,
MTStorage
,
Synchronization
,
PackableStorage
,
\
from
ZODB.tests
import
PackableStorage
,
RevisionStorage
RevisionStorage
class
Transaction
(
object
):
class
Transaction
(
object
):
"""Hold data for current transaction for MinimalMemoryStorage."""
"""Hold data for current transaction for MinimalMemoryStorage."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment