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
aa6a0112
Commit
aa6a0112
authored
Feb 10, 2001
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge in changes from "PacklessBerkeley3Storage" product.
parent
493a069e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
lib/python/BDBStorage/Packless.py
lib/python/BDBStorage/Packless.py
+33
-10
No files found.
lib/python/BDBStorage/Packless.py
View file @
aa6a0112
...
...
@@ -88,9 +88,10 @@ counting garbage-collection strategy which necessitates packing only when
the stored data has cyclically-referenced garbage.
"""
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
from
base
import
Base
from
base
import
BerkeleyDBError
from
bsddb3
import
db
from
struct
import
pack
,
unpack
from
ZODB.referencesf
import
referencesf
...
...
@@ -109,6 +110,7 @@ class OutOfTempSpaceError(POSException.POSError):
""" An out-of-disk-space error occured when writing a temporary log
file. """
class
Packless
(
Base
):
def
_setupDbs
(
self
):
...
...
@@ -130,9 +132,14 @@ class Packless(Base):
def
load
(
self
,
oid
,
version
):
self
.
_lock_acquire
()
try
:
s
=
self
.
_index
[
oid
]
p
=
self
.
_opickle
[
oid
]
return
p
,
s
# pickle, serial
try
:
s
=
self
.
_index
[
oid
]
p
=
self
.
_opickle
[
oid
]
return
p
,
s
# pickle, serial
except
db
.
error
,
msg
:
raise
BerkeleyDBError
,
(
"%s (%s)"
%
(
BerkeleyDBError
.
__doc__
,
msg
)
)
finally
:
self
.
_lock_release
()
def
store
(
self
,
oid
,
serial
,
data
,
version
,
transaction
):
...
...
@@ -154,7 +161,9 @@ class Packless(Base):
# write the pickle to the temp log
self
.
_tmp
.
write
(
data
)
except
IOError
:
raise
OutOfTempSpaceError
,
self
.
_tempdir
raise
OutOfTempSpaceError
,
(
"%s (%s)"
%
(
OutOfTempSpaceError
.
__doc__
,
self
.
_tempdir
)
)
finally
:
self
.
_lock_release
()
return
serial
...
...
@@ -223,8 +232,10 @@ class Packless(Base):
rc
=
rc
-
1
if
rc
<
0
:
# This should never happen
raise
ReferenceCountError
,
(
"Oid %s had refcount %s"
%
(
`roid`
,
rc
)
rce
=
ReferenceCountError
raise
rce
,
(
"%s (Oid %s had refcount %s)"
%
(
rce
.
__doc__
,
`roid`
,
rc
)
)
referenceCount_put
(
roid
,
pack
(
">i"
,
rc
),
txn
)
if
rc
==
0
:
zeros
[
roid
]
=
1
...
...
@@ -250,7 +261,9 @@ class Packless(Base):
l
=
l
+
ldata
+
oidlen
+
intlen
if
ldata
>
fsize
:
# this should never happen.
raise
TemporaryLogCorruptedError
raise
TemporaryLogCorruptedError
,
(
TemporaryLogCorruptedError
.
__doc__
)
serial_put
(
oid
,
serial
,
txn
)
opickle_put
(
oid
,
data
,
txn
)
...
...
@@ -262,6 +275,14 @@ class Packless(Base):
tmp
.
seek
(
0
)
if
fsize
>
MAXTEMPFSIZE
:
tmp
.
truncate
()
except
db
.
error
,
msg
:
try
:
txn
.
abort
()
except
db
.
error
,
msg
:
raise
BerkeleyDBError
,
"%s (%s)"
%
(
BerkeleyDBError
.
__doc__
,
msg
)
raise
BerkeleyDBError
,
"%s (%s)"
%
(
BerkeleyDBError
.
__doc__
,
msg
)
except
:
txn
.
abort
()
raise
...
...
@@ -293,8 +314,10 @@ class Packless(Base):
if
rc
:
rc
=
unpack
(
">i"
,
rc
)[
0
]
-
1
if
rc
<
0
:
raise
ReferenceCountError
,
(
"Oid %s had refcount %s"
%
(
`roid`
,
rc
)
rce
=
ReferenceCountError
raise
rce
,
(
"%s (Oid %s had refcount %s)"
%
(
rce
.
__doc__
,
`roid`
,
rc
)
)
if
rc
==
0
:
self
.
_takeOutGarbage
(
roid
,
txn
)
else
:
referenceCount_put
(
roid
,
pack
(
">i"
,
rc
),
txn
)
...
...
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