Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
bc3d1097
Commit
bc3d1097
authored
Nov 26, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide much simpler version of getSerial().
parent
32f4f31c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
28 deletions
+9
-28
src/ZODB/FileStorage.py
src/ZODB/FileStorage.py
+9
-28
No files found.
src/ZODB/FileStorage.py
View file @
bc3d1097
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version
# may have a back pointer to a version record or to a non-version
# record.
# record.
#
#
__version__
=
'$Revision: 1.11
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.11
7
$'
[
11
:
-
2
]
import
base64
import
base64
from
cPickle
import
Pickler
,
Unpickler
,
loads
from
cPickle
import
Pickler
,
Unpickler
,
loads
...
@@ -573,31 +573,6 @@ class FileStorage(BaseStorage.BaseStorage,
...
@@ -573,31 +573,6 @@ class FileStorage(BaseStorage.BaseStorage,
if
plen
!=
z64
:
return
read
(
U64
(
plen
)),
version
,
nv
if
plen
!=
z64
:
return
read
(
U64
(
plen
)),
version
,
nv
return
_loadBack
(
file
,
oid
,
read
(
8
))[
0
],
version
,
nv
return
_loadBack
(
file
,
oid
,
read
(
8
))[
0
],
version
,
nv
def
getSerial
(
self
,
oid
):
self
.
_lock_acquire
()
try
:
pos
=
self
.
_index
[
oid
]
self
.
_file
.
seek
(
pos
)
h
=
self
.
_file
.
read
(
34
)
_oid
=
h
[:
8
]
if
_oid
!=
oid
:
raise
CorruptedDataError
,
h
vlen
=
unpack
(
">H"
,
h
[
-
2
:])[
0
]
if
vlen
:
# If there is a version, find out its name and let
# _load() do all the work. This is less efficient
# than possible, because _load() will load the pickle
# data. Being more efficient is too complicated.
self
.
_file
.
seek
(
24
,
1
)
# skip plen, pnv, and pv
version
=
self
.
_file
.
read
(
vlen
)
pickledata
,
serial
=
self
.
_load
(
oid
,
version
,
self
.
_index
,
self
.
_file
)
return
serial
return
h
[
8
:
16
]
finally
:
self
.
_lock_release
()
def
_load
(
self
,
oid
,
version
,
_index
,
file
):
def
_load
(
self
,
oid
,
version
,
_index
,
file
):
try
:
try
:
pos
=
_index
[
oid
]
pos
=
_index
[
oid
]
...
@@ -1045,6 +1020,13 @@ class FileStorage(BaseStorage.BaseStorage,
...
@@ -1045,6 +1020,13 @@ class FileStorage(BaseStorage.BaseStorage,
else
:
else
:
return
''
,
''
return
''
,
''
def
getSerial
(
self
,
oid
):
self
.
_lock_acquire
()
try
:
return
self
.
_getSerial
(
oid
,
self
.
_index
[
oid
])
finally
:
self
.
_lock_release
()
def
_getSerial
(
self
,
oid
,
pos
):
def
_getSerial
(
self
,
oid
,
pos
):
self
.
_file
.
seek
(
pos
)
self
.
_file
.
seek
(
pos
)
h
=
self
.
_file
.
read
(
16
)
h
=
self
.
_file
.
read
(
16
)
...
@@ -1222,8 +1204,7 @@ class FileStorage(BaseStorage.BaseStorage,
...
@@ -1222,8 +1204,7 @@ class FileStorage(BaseStorage.BaseStorage,
while
pos
<
tend
:
while
pos
<
tend
:
self
.
_file
.
seek
(
pos
)
self
.
_file
.
seek
(
pos
)
h
=
self
.
_file
.
read
(
DATA_HDR_LEN
)
h
=
self
.
_file
.
read
(
DATA_HDR_LEN
)
oid
,
serial
,
sprev
,
stloc
,
vlen
,
splen
=
\
oid
,
serial
,
sprev
,
stloc
,
vlen
,
splen
=
struct
.
unpack
(
DATA_HDR
,
h
)
struct
.
unpack
(
DATA_HDR
,
h
)
if
failed
(
oid
):
if
failed
(
oid
):
del
failures
[
oid
]
# second chance!
del
failures
[
oid
]
# second chance!
plen
=
U64
(
splen
)
plen
=
U64
(
splen
)
...
...
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