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
565a1afd
Commit
565a1afd
authored
Nov 28, 2003
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged Jeremy and Tim's changes from the zodb33-devel-branch.
parent
322ceda2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
24 deletions
+38
-24
lib/python/BDBStorage/BDBFullStorage.py
lib/python/BDBStorage/BDBFullStorage.py
+7
-5
lib/python/BDBStorage/BDBMinimalStorage.py
lib/python/BDBStorage/BDBMinimalStorage.py
+6
-4
lib/python/BDBStorage/BerkeleyBase.py
lib/python/BDBStorage/BerkeleyBase.py
+1
-2
lib/python/BDBStorage/_helper.c
lib/python/BDBStorage/_helper.c
+16
-5
lib/python/BDBStorage/tests/test_autopack.py
lib/python/BDBStorage/tests/test_autopack.py
+3
-2
lib/python/BDBStorage/tests/test_virgin.py
lib/python/BDBStorage/tests/test_virgin.py
+1
-2
lib/python/BDBStorage/tests/test_whitebox.py
lib/python/BDBStorage/tests/test_whitebox.py
+1
-1
lib/python/BDBStorage/tests/test_zodb_simple.py
lib/python/BDBStorage/tests/test_zodb_simple.py
+1
-1
lib/python/BDBStorage/tests/timeiter.py
lib/python/BDBStorage/tests/timeiter.py
+1
-1
lib/python/BDBStorage/tests/timepickles.py
lib/python/BDBStorage/tests/timepickles.py
+1
-1
No files found.
lib/python/BDBStorage/BDBFullStorage.py
View file @
565a1afd
...
...
@@ -14,7 +14,7 @@
"""Berkeley storage with full undo and versioning support.
$Revision: 1.7
5
$
$Revision: 1.7
6
$
"""
import
time
...
...
@@ -24,7 +24,7 @@ from struct import pack, unpack
from
ZODB
import
POSException
from
ZODB.utils
import
p64
,
U64
from
ZODB.referencesf
import
referencesf
from
ZODB
.TimeStamp
import
TimeStamp
from
persistent
.TimeStamp
import
TimeStamp
from
ZODB.ConflictResolution
import
ConflictResolvingStorage
,
ResolvedSerial
from
BDBStorage
import
db
,
ZERO
...
...
@@ -484,11 +484,13 @@ class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
# given in the call is not the same as the last stored serial
# number. First, attempt application level conflict
# resolution, and if that fails, raise a ConflictError.
data
=
self
.
tryToResolveConflict
(
oid
,
oserial
,
serial
,
data
)
if
data
:
r
data
=
self
.
tryToResolveConflict
(
oid
,
oserial
,
serial
,
data
)
if
r
data
:
conflictresolved
=
True
data
=
rdata
else
:
raise
POSException
.
ConflictError
(
serials
=
(
oserial
,
serial
))
raise
POSException
.
ConflictError
(
oid
=
oid
,
serials
=
(
oserial
,
serial
),
data
=
data
)
# Do we already know about this version? If not, we need to record
# the fact that a new version is being created. version will be the
# empty string when the transaction is storing on the non-version
...
...
lib/python/BDBStorage/BDBMinimalStorage.py
View file @
565a1afd
...
...
@@ -15,7 +15,7 @@
"""Berkeley storage without undo or versioning.
"""
__version__
=
'$Revision: 1.3
2
$'
[
-
2
:][
0
]
__version__
=
'$Revision: 1.3
3
$'
[
-
2
:][
0
]
from
ZODB
import
POSException
from
ZODB.utils
import
p64
,
U64
...
...
@@ -262,11 +262,13 @@ class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
# The object exists in the database, but the serial number
# given in the call is not the same as the last stored serial
# number. Raise a ConflictError.
data
=
self
.
tryToResolveConflict
(
oid
,
oserial
,
serial
,
data
)
if
data
:
r
data
=
self
.
tryToResolveConflict
(
oid
,
oserial
,
serial
,
data
)
if
r
data
:
conflictresolved
=
True
data
=
rdata
else
:
raise
POSException
.
ConflictError
(
serials
=
(
oserial
,
serial
))
raise
POSException
.
ConflictError
(
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
...
...
lib/python/BDBStorage/BerkeleyBase.py
View file @
565a1afd
...
...
@@ -32,7 +32,6 @@ from BDBStorage import db, ZERO
from
ZODB.lock_file
import
lock_file
from
ZODB.BaseStorage
import
BaseStorage
from
ZODB.referencesf
import
referencesf
import
ThreadLock
import
zLOG
GBYTES
=
1024
*
1024
*
1000
...
...
@@ -219,7 +218,7 @@ class BerkeleyBase(BaseStorage):
self
.
_is_read_only
=
config
.
read_only
# Instantiate a pack lock
self
.
_packlock
=
ThreadLock
.
allocate_l
ock
()
self
.
_packlock
=
threading
.
RL
ock
()
self
.
_stop
=
self
.
_closed
=
False
# Initialize a few other things
self
.
_prefix
=
prefix
...
...
lib/python/BDBStorage/_helper.c
View file @
565a1afd
...
...
@@ -23,10 +23,17 @@
#error "Must be using at least Python 2.2"
#endif
/* Increment an 8-byte unsigned integer (represented as an 8-byte raw string),
* by a Python integer.
* The arguments are an 8-byte Python string, and a Python int or long.
* The result is an 8-byte Python string, representing their sum.
* XXX It's unclear what this intends to do if the sum overflows an 8-byte
* XXX unsigned integer. _PyLong_AsByteArray should raise OverflowError then.
*/
static
PyObject
*
helper_incr
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
pylong
,
*
incr
,
*
sum
;
PyObject
*
pylong
=
NULL
,
*
incr
,
*
sum
=
NULL
,
*
result
=
NULL
;
char
*
s
,
x
[
8
];
int
len
,
res
;
...
...
@@ -42,21 +49,25 @@ helper_incr(PyObject* self, PyObject* args)
pylong
=
_PyLong_FromByteArray
(
s
,
len
,
0
/* big endian */
,
0
/* unsigned */
);
if
(
!
pylong
)
return
NULL
;
sum
=
PyNumber_Add
(
pylong
,
incr
);
if
(
!
sum
)
return
NULL
;
goto
err
;
res
=
_PyLong_AsByteArray
((
PyLongObject
*
)
sum
,
x
,
8
,
0
/* big endian */
,
0
/* unsigned */
);
if
(
res
<
0
)
return
NULL
;
goto
err
;
return
PyString_FromStringAndSize
(
x
,
8
);
result
=
PyString_FromStringAndSize
(
x
,
8
);
err:
Py_XDECREF
(
pylong
);
Py_XDECREF
(
sum
);
return
result
;
}
...
...
lib/python/BDBStorage/tests/test_autopack.py
View file @
565a1afd
...
...
@@ -17,13 +17,14 @@ import time
import
unittest
import
threading
from
persistent.TimeStamp
import
TimeStamp
from
ZODB
import
DB
from
ZODB.Transaction
import
Transaction
from
ZODB.referencesf
import
referencesf
from
ZODB.TimeStamp
import
TimeStamp
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_pickle
from
Persistence
import
Persistent
from
persistent
import
Persistent
import
BDBStorage
if
BDBStorage
.
is_available
:
...
...
lib/python/BDBStorage/tests/test_virgin.py
View file @
565a1afd
...
...
@@ -18,8 +18,7 @@ import unittest
import
BDBStorage
from
BDBStorage.tests.ZODBTestBase
import
ZODBTestBase
from
Persistence
import
PersistentMapping
from
persistent.mapping
import
PersistentMapping
class
InsertMixin
:
...
...
lib/python/BDBStorage/tests/test_whitebox.py
View file @
565a1afd
...
...
@@ -32,7 +32,7 @@ else:
from
BDBStorage.tests.ZODBTestBase
import
ZODBTestBase
from
BDBStorage.tests.BerkeleyTestBase
import
BerkeleyTestBase
from
Persistence
import
Persistent
from
persistent
import
Persistent
ZERO
=
'
\
0
'
*
8
...
...
lib/python/BDBStorage/tests/test_zodb_simple.py
View file @
565a1afd
...
...
@@ -21,7 +21,7 @@ import unittest
import
BDBStorage
from
BDBStorage.tests.ZODBTestBase
import
ZODBTestBase
from
Persistence
import
PersistentMapping
from
persistent.mapping
import
PersistentMapping
...
...
lib/python/BDBStorage/tests/timeiter.py
View file @
565a1afd
...
...
@@ -63,7 +63,7 @@ import marshal
from
bsddb3
import
db
from
ZODB
import
utils
from
ZODB
.TimeStamp
import
TimeStamp
from
persistent
.TimeStamp
import
TimeStamp
from
ZODB.FileStorage
import
FileStorage
from
BDBStorage.BDBFullStorage
import
BDBFullStorage
...
...
lib/python/BDBStorage/tests/timepickles.py
View file @
565a1afd
...
...
@@ -63,7 +63,7 @@ import marshal
from
bsddb3
import
db
from
ZODB
import
utils
from
ZODB
.TimeStamp
import
TimeStamp
from
persistent
.TimeStamp
import
TimeStamp
from
ZODB.FileStorage
import
FileStorage
from
BDBStorage.BDBFullStorage
import
BDBFullStorage
...
...
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