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
Show 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 @@
"""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.utils
import
p64
,
U64
...
...
@@ -158,10 +158,10 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
self
.
_pending
.
truncate
(
txn
)
def
_abort
(
self
):
self
.
_withtxn
(
self
.
_doabort
,
self
.
_
serial
)
self
.
_withtxn
(
self
.
_doabort
,
self
.
_
tid
)
def
_docommit
(
self
,
txn
,
tid
):
self
.
_pending
.
put
(
self
.
_
serial
,
COMMIT
,
txn
)
self
.
_pending
.
put
(
self
.
_
tid
,
COMMIT
,
txn
)
deltas
=
{}
co
=
cs
=
None
try
:
...
...
@@ -248,7 +248,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# will be aborted.
txn
=
self
.
_env
.
txn_begin
()
try
:
self
.
_pending
.
put
(
self
.
_
serial
,
ABORT
,
txn
)
self
.
_pending
.
put
(
self
.
_
tid
,
ABORT
,
txn
)
except
:
txn
.
abort
()
raise
...
...
@@ -271,7 +271,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
oid
=
oid
,
serials
=
(
oserial
,
serial
),
data
=
data
)
# Optimistically write to the serials and pickles table. Be sure
# to also update the oids table for this object too.
newserial
=
self
.
_
serial
newserial
=
self
.
_
tid
self
.
_serials
.
put
(
oid
,
newserial
,
txn
=
txn
)
self
.
_pickles
.
put
(
oid
+
newserial
,
data
,
txn
=
txn
)
self
.
_oids
.
put
(
oid
,
PRESENT
,
txn
=
txn
)
...
...
@@ -305,7 +305,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# _docommit() twiddles the pending flag to COMMIT now since after the
# vote call, we promise that the changes will be committed, no matter
# what. The recovery process will check this.
self
.
_withtxn
(
self
.
_docommit
,
self
.
_
serial
)
self
.
_withtxn
(
self
.
_docommit
,
self
.
_
tid
)
#
# Accessor interface
...
...
@@ -340,7 +340,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
return
None
if
len
(
serials
)
==
1
:
return
serials
[
0
]
pending
=
self
.
_pending
.
get
(
self
.
_
serial
)
pending
=
self
.
_pending
.
get
(
self
.
_
tid
)
assert
pending
in
(
ABORT
,
COMMIT
)
if
pending
==
ABORT
:
return
serials
[
0
]
...
...
@@ -363,7 +363,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
self
.
_lock_release
()
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.
return
''
...
...
@@ -548,7 +548,7 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# versionEmpty(self, version)
# versions(self, max=None)
# loadSerial(self, oid, serial)
# get
Serial
(self, oid)
# get
Tid
(self, oid)
# transactionalUndo(self, tid, transaction)
# undoLog(self, first=0, last=-20, 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'
class
BerkeleyTestBase
(
StorageTestBase
):
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
# 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
# for the purposes of the test suite we shut off this thread.
config
=
BerkeleyConfig
()
config
.
interval
=
0
config
.
read_only
=
read_only
return
config
def
_envdir
(
self
):
return
DBHOME
def
open
(
self
):
def
open
(
self
,
read_only
=
False
):
self
.
_storage
=
self
.
ConcreteStorage
(
self
.
_envdir
(),
config
=
self
.
_config
())
self
.
_envdir
(),
config
=
self
.
_config
(
read_only
))
def
_zap_dbhome
(
self
,
dir
=
None
):
if
dir
is
None
:
...
...
lib/python/BDBStorage/tests/test_autopack.py
View file @
81748109
...
...
@@ -52,12 +52,13 @@ class C(Persistent):
class
TestAutopackBase
(
BerkeleyTestBase
):
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
# Autopack every 1 second, 2 seconds into the past, no classic packs
config
.
frequency
=
1
config
.
packtime
=
2
config
.
gcpack
=
0
config
.
read_only
=
read_only
return
config
def
_wait_for_next_autopack
(
self
):
...
...
@@ -114,13 +115,14 @@ class TestAutopack(TestAutopackBase):
class
TestAutomaticClassicPack
(
TestAutopackBase
):
ConcreteStorage
=
BDBFullStorage
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
# Autopack every 1 second, 2 seconds into the past, classic packing
# every time.
config
.
frequency
=
1
config
.
packtime
=
2
config
.
gcpack
=
1
config
.
read_only
=
read_only
return
config
def
testAutomaticClassicPack
(
self
):
...
...
@@ -196,10 +198,11 @@ class TestAutomaticClassicPack(TestAutopackBase):
class
TestMinimalPack
(
TestAutopackBase
):
ConcreteStorage
=
BDBMinimalStorage
def
_config
(
self
):
def
_config
(
self
,
read_only
=
False
):
config
=
BerkeleyConfig
()
# Autopack every 3 seconds
config
.
frequency
=
3
config
.
read_only
=
read_only
return
config
def
testRootUnreachable
(
self
):
...
...
lib/python/BDBStorage/tests/test_storage_api.py
View file @
81748109
...
...
@@ -21,20 +21,32 @@ import BDBStorage
from
BDBStorage.tests
import
BerkeleyTestBase
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.
VersionStorage
import
Version
Storage
from
ZODB.tests.
Synchronization
import
Synchronized
Storage
from
ZODB.tests.TransactionalUndoStorage
import
TransactionalUndoStorage
from
ZODB.tests.TransactionalUndoVersionStorage
import
\
TransactionalUndoVersionStorage
from
ZODB.tests.PackableStorage
import
PackableStorage
from
ZODB.tests.HistoryStorage
import
HistoryStorage
from
ZODB.tests.IteratorStorage
import
IteratorStorage
,
ExtendedIteratorStorage
from
ZODB.tests.RecoveryStorage
import
RecoveryStorage
from
ZODB.tests.VersionStorage
import
VersionStorage
from
ZODB.tests
import
ConflictResolution
class
MinimalTest
(
BerkeleyTestBase
.
MinimalTestBase
,
BasicStorage
):
class
MinimalTest
(
BerkeleyTestBase
.
MinimalTestBase
,
BasicStorage
,
MTStorage
,
PackableStorage
,
ReadOnlyStorage
,
SynchronizedStorage
,
):
def
checkVersionedStoreAndLoad
(
self
):
# This storage doesn't support versions, so we should get an exception
oid
=
self
.
_storage
.
new_oid
()
...
...
@@ -47,11 +59,15 @@ class FullTest(BerkeleyTestBase.FullTestBase, BasicStorage,
RevisionStorage
,
VersionStorage
,
TransactionalUndoStorage
,
TransactionalUndoVersionStorage
,
PackableStorage
,
PackableStorage
,
PackableUndoStorage
,
HistoryStorage
,
IteratorStorage
,
ExtendedIteratorStorage
,
ConflictResolution
.
ConflictResolvingStorage
,
ConflictResolution
.
ConflictResolvingTransUndoStorage
):
ConflictResolution
.
ConflictResolvingTransUndoStorage
,
SynchronizedStorage
,
PersistentStorage
,
MTStorage
,
ReadOnlyStorage
):
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