Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
81748109
Commit
81748109
authored
Dec 24, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge MVCC branch to the HEAD.
parent
f72e57be
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
130 deletions
+196
-130
lib/python/BDBStorage/BDBFullStorage.py
lib/python/BDBStorage/BDBFullStorage.py
+153
-107
lib/python/BDBStorage/BDBMinimalStorage.py
lib/python/BDBStorage/BDBMinimalStorage.py
+9
-9
lib/python/BDBStorage/tests/BerkeleyTestBase.py
lib/python/BDBStorage/tests/BerkeleyTestBase.py
+4
-3
lib/python/BDBStorage/tests/test_autopack.py
lib/python/BDBStorage/tests/test_autopack.py
+6
-3
lib/python/BDBStorage/tests/test_storage_api.py
lib/python/BDBStorage/tests/test_storage_api.py
+24
-8
No files found.
lib/python/BDBStorage/BDBFullStorage.py
View file @
81748109
This diff is collapsed.
Click to expand it.
lib/python/BDBStorage/BDBMinimalStorage.py
View file @
81748109
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
"""Berkeley storage without undo or versioning.
"""Berkeley storage without undo or versioning.
"""
"""
__version__
=
'$Revision: 1.3
3
$'
[
-
2
:][
0
]
__version__
=
'$Revision: 1.3
4
$'
[
-
2
:][
0
]
from
ZODB
import
POSException
from
ZODB
import
POSException
from
ZODB.utils
import
p64
,
U64
from
ZODB.utils
import
p64
,
U64
...
@@ -158,10 +158,10 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -158,10 +158,10 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
self
.
_pending
.
truncate
(
txn
)
self
.
_pending
.
truncate
(
txn
)
def
_abort
(
self
):
def
_abort
(
self
):
self
.
_withtxn
(
self
.
_doabort
,
self
.
_
serial
)
self
.
_withtxn
(
self
.
_doabort
,
self
.
_
tid
)
def
_docommit
(
self
,
txn
,
tid
):
def
_docommit
(
self
,
txn
,
tid
):
self
.
_pending
.
put
(
self
.
_
serial
,
COMMIT
,
txn
)
self
.
_pending
.
put
(
self
.
_
tid
,
COMMIT
,
txn
)
deltas
=
{}
deltas
=
{}
co
=
cs
=
None
co
=
cs
=
None
try
:
try
:
...
@@ -248,7 +248,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -248,7 +248,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# will be aborted.
# will be aborted.
txn
=
self
.
_env
.
txn_begin
()
txn
=
self
.
_env
.
txn_begin
()
try
:
try
:
self
.
_pending
.
put
(
self
.
_
serial
,
ABORT
,
txn
)
self
.
_pending
.
put
(
self
.
_
tid
,
ABORT
,
txn
)
except
:
except
:
txn
.
abort
()
txn
.
abort
()
raise
raise
...
@@ -271,7 +271,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -271,7 +271,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
oid
=
oid
,
serials
=
(
oserial
,
serial
),
data
=
data
)
oid
=
oid
,
serials
=
(
oserial
,
serial
),
data
=
data
)
# Optimistically write to the serials and pickles table. Be sure
# Optimistically write to the serials and pickles table. Be sure
# to also update the oids table for this object too.
# to also update the oids table for this object too.
newserial
=
self
.
_
serial
newserial
=
self
.
_
tid
self
.
_serials
.
put
(
oid
,
newserial
,
txn
=
txn
)
self
.
_serials
.
put
(
oid
,
newserial
,
txn
=
txn
)
self
.
_pickles
.
put
(
oid
+
newserial
,
data
,
txn
=
txn
)
self
.
_pickles
.
put
(
oid
+
newserial
,
data
,
txn
=
txn
)
self
.
_oids
.
put
(
oid
,
PRESENT
,
txn
=
txn
)
self
.
_oids
.
put
(
oid
,
PRESENT
,
txn
=
txn
)
...
@@ -305,7 +305,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -305,7 +305,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# _docommit() twiddles the pending flag to COMMIT now since after the
# _docommit() twiddles the pending flag to COMMIT now since after the
# vote call, we promise that the changes will be committed, no matter
# vote call, we promise that the changes will be committed, no matter
# what. The recovery process will check this.
# what. The recovery process will check this.
self
.
_withtxn
(
self
.
_docommit
,
self
.
_
serial
)
self
.
_withtxn
(
self
.
_docommit
,
self
.
_
tid
)
#
#
# Accessor interface
# Accessor interface
...
@@ -340,7 +340,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -340,7 +340,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
return
None
return
None
if
len
(
serials
)
==
1
:
if
len
(
serials
)
==
1
:
return
serials
[
0
]
return
serials
[
0
]
pending
=
self
.
_pending
.
get
(
self
.
_
serial
)
pending
=
self
.
_pending
.
get
(
self
.
_
tid
)
assert
pending
in
(
ABORT
,
COMMIT
)
assert
pending
in
(
ABORT
,
COMMIT
)
if
pending
==
ABORT
:
if
pending
==
ABORT
:
return
serials
[
0
]
return
serials
[
0
]
...
@@ -363,7 +363,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -363,7 +363,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
self
.
_lock_release
()
self
.
_lock_release
()
def
modifiedInVersion
(
self
,
oid
):
def
modifiedInVersion
(
self
,
oid
):
# So BaseStorage.get
Serial
() just works. Note that this storage
# So BaseStorage.get
Tid
() just works. Note that this storage
# doesn't support versions.
# doesn't support versions.
return
''
return
''
...
@@ -548,7 +548,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
...
@@ -548,7 +548,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# versionEmpty(self, version)
# versionEmpty(self, version)
# versions(self, max=None)
# versions(self, max=None)
# loadSerial(self, oid, serial)
# loadSerial(self, oid, serial)
# get
Serial
(self, oid)
# get
Tid
(self, oid)
# transactionalUndo(self, tid, transaction)
# transactionalUndo(self, tid, transaction)
# undoLog(self, first=0, last=-20, filter=None)
# undoLog(self, first=0, last=-20, filter=None)
# history(self, oid, version=None, size=1, filter=None)
# history(self, oid, version=None, size=1, filter=None)
...
...
lib/python/BDBStorage/tests/BerkeleyTestBase.py
View file @
81748109
...
@@ -29,20 +29,21 @@ DBHOME = 'test-db'
...
@@ -29,20 +29,21 @@ DBHOME = 'test-db'
class
BerkeleyTestBase
(
StorageTestBase
):
class
BerkeleyTestBase
(
StorageTestBase
):
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
# Checkpointing just slows the tests down because we have to wait for
# Checkpointing just slows the tests down because we have to wait for
# the thread to properly shutdown. This can take up to 10 seconds, so
# the thread to properly shutdown. This can take up to 10 seconds, so
# for the purposes of the test suite we shut off this thread.
# for the purposes of the test suite we shut off this thread.
config
=
BerkeleyConfig
()
config
=
BerkeleyConfig
()
config
.
interval
=
0
config
.
interval
=
0
config
.
read_only
=
read_only
return
config
return
config
def
_envdir
(
self
):
def
_envdir
(
self
):
return
DBHOME
return
DBHOME
def
open
(
self
):
def
open
(
self
,
read_only
=
False
):
self
.
_storage
=
self
.
ConcreteStorage
(
self
.
_storage
=
self
.
ConcreteStorage
(
self
.
_envdir
(),
config
=
self
.
_config
())
self
.
_envdir
(),
config
=
self
.
_config
(
read_only
))
def
_zap_dbhome
(
self
,
dir
=
None
):
def
_zap_dbhome
(
self
,
dir
=
None
):
if
dir
is
None
:
if
dir
is
None
:
...
...
lib/python/BDBStorage/tests/test_autopack.py
View file @
81748109
...
@@ -52,12 +52,13 @@ class C(Persistent):
...
@@ -52,12 +52,13 @@ class C(Persistent):
class
TestAutopackBase
(
BerkeleyTestBase
):
class
TestAutopackBase
(
BerkeleyTestBase
):
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
config
=
BerkeleyConfig
()
# Autopack every 1 second, 2 seconds into the past, no classic packs
# Autopack every 1 second, 2 seconds into the past, no classic packs
config
.
frequency
=
1
config
.
frequency
=
1
config
.
packtime
=
2
config
.
packtime
=
2
config
.
gcpack
=
0
config
.
gcpack
=
0
config
.
read_only
=
read_only
return
config
return
config
def
_wait_for_next_autopack
(
self
):
def
_wait_for_next_autopack
(
self
):
...
@@ -114,13 +115,14 @@ class TestAutopack(TestAutopackBase):
...
@@ -114,13 +115,14 @@ class TestAutopack(TestAutopackBase):
class
TestAutomaticClassicPack
(
TestAutopackBase
):
class
TestAutomaticClassicPack
(
TestAutopackBase
):
ConcreteStorage
=
BDBFullStorage
ConcreteStorage
=
BDBFullStorage
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
config
=
BerkeleyConfig
()
# Autopack every 1 second, 2 seconds into the past, classic packing
# Autopack every 1 second, 2 seconds into the past, classic packing
# every time.
# every time.
config
.
frequency
=
1
config
.
frequency
=
1
config
.
packtime
=
2
config
.
packtime
=
2
config
.
gcpack
=
1
config
.
gcpack
=
1
config
.
read_only
=
read_only
return
config
return
config
def
testAutomaticClassicPack
(
self
):
def
testAutomaticClassicPack
(
self
):
...
@@ -196,10 +198,11 @@ class TestAutomaticClassicPack(TestAutopackBase):
...
@@ -196,10 +198,11 @@ class TestAutomaticClassicPack(TestAutopackBase):
class
TestMinimalPack
(
TestAutopackBase
):
class
TestMinimalPack
(
TestAutopackBase
):
ConcreteStorage
=
BDBMinimalStorage
ConcreteStorage
=
BDBMinimalStorage
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
config
=
BerkeleyConfig
()
# Autopack every 3 seconds
# Autopack every 3 seconds
config
.
frequency
=
3
config
.
frequency
=
3
config
.
read_only
=
read_only
return
config
return
config
def
testRootUnreachable
(
self
):
def
testRootUnreachable
(
self
):
...
...
lib/python/BDBStorage/tests/test_storage_api.py
View file @
81748109
...
@@ -21,20 +21,32 @@ import BDBStorage
...
@@ -21,20 +21,32 @@ import BDBStorage
from
BDBStorage.tests
import
BerkeleyTestBase
from
BDBStorage.tests
import
BerkeleyTestBase
from
ZODB.tests.BasicStorage
import
BasicStorage
from
ZODB.tests.BasicStorage
import
BasicStorage
from
ZODB.tests.HistoryStorage
import
HistoryStorage
from
ZODB.tests.IteratorStorage
import
IteratorStorage
,
ExtendedIteratorStorage
from
ZODB.tests.MTStorage
import
MTStorage
from
ZODB.tests.PackableStorage
import
PackableStorage
,
PackableUndoStorage
from
ZODB.tests.PersistentStorage
import
PersistentStorage
from
ZODB.tests.ReadOnlyStorage
import
ReadOnlyStorage
from
ZODB.tests.RecoveryStorage
import
RecoveryStorage
from
ZODB.tests.RevisionStorage
import
RevisionStorage
from
ZODB.tests.RevisionStorage
import
RevisionStorage
from
ZODB.tests.
VersionStorage
import
Version
Storage
from
ZODB.tests.
Synchronization
import
Synchronized
Storage
from
ZODB.tests.TransactionalUndoStorage
import
TransactionalUndoStorage
from
ZODB.tests.TransactionalUndoStorage
import
TransactionalUndoStorage
from
ZODB.tests.TransactionalUndoVersionStorage
import
\
from
ZODB.tests.TransactionalUndoVersionStorage
import
\
TransactionalUndoVersionStorage
TransactionalUndoVersionStorage
from
ZODB.tests.PackableStorage
import
PackableStorage
from
ZODB.tests.VersionStorage
import
VersionStorage
from
ZODB.tests.HistoryStorage
import
HistoryStorage
from
ZODB.tests.IteratorStorage
import
IteratorStorage
,
ExtendedIteratorStorage
from
ZODB.tests.RecoveryStorage
import
RecoveryStorage
from
ZODB.tests
import
ConflictResolution
from
ZODB.tests
import
ConflictResolution
class
MinimalTest
(
BerkeleyTestBase
.
MinimalTestBase
,
BasicStorage
):
class
MinimalTest
(
BerkeleyTestBase
.
MinimalTestBase
,
BasicStorage
,
MTStorage
,
PackableStorage
,
ReadOnlyStorage
,
SynchronizedStorage
,
):
def
checkVersionedStoreAndLoad
(
self
):
def
checkVersionedStoreAndLoad
(
self
):
# This storage doesn't support versions, so we should get an exception
# This storage doesn't support versions, so we should get an exception
oid
=
self
.
_storage
.
new_oid
()
oid
=
self
.
_storage
.
new_oid
()
...
@@ -47,11 +59,15 @@ class FullTest(BerkeleyTestBase.FullTestBase, BasicStorage,
...
@@ -47,11 +59,15 @@ class FullTest(BerkeleyTestBase.FullTestBase, BasicStorage,
RevisionStorage
,
VersionStorage
,
RevisionStorage
,
VersionStorage
,
TransactionalUndoStorage
,
TransactionalUndoStorage
,
TransactionalUndoVersionStorage
,
TransactionalUndoVersionStorage
,
PackableStorage
,
PackableStorage
,
PackableUndoStorage
,
HistoryStorage
,
HistoryStorage
,
IteratorStorage
,
ExtendedIteratorStorage
,
IteratorStorage
,
ExtendedIteratorStorage
,
ConflictResolution
.
ConflictResolvingStorage
,
ConflictResolution
.
ConflictResolvingStorage
,
ConflictResolution
.
ConflictResolvingTransUndoStorage
):
ConflictResolution
.
ConflictResolvingTransUndoStorage
,
SynchronizedStorage
,
PersistentStorage
,
MTStorage
,
ReadOnlyStorage
):
pass
pass
...
...
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