Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
2ef8c745
Commit
2ef8c745
authored
May 20, 2000
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new method to load historical object revisions.
parent
d9c39a6c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
src/ZODB/BaseStorage.py
src/ZODB/BaseStorage.py
+4
-1
src/ZODB/Connection.py
src/ZODB/Connection.py
+11
-2
src/ZODB/FileStorage.py
src/ZODB/FileStorage.py
+29
-1
No files found.
src/ZODB/BaseStorage.py
View file @
2ef8c745
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Handy standard storage machinery
"""
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
import
time
,
bpthread
,
UndoLogCompatible
from
POSException
import
UndoError
...
...
@@ -218,3 +218,6 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
def
pack
(
self
,
t
,
referencesf
):
pass
def
loadSerial
(
self
,
oid
,
serial
):
raise
POSException
.
Unsupported
,
(
"Retrieval of historical revisions is not supported"
)
src/ZODB/Connection.py
View file @
2ef8c745
...
...
@@ -84,8 +84,8 @@
##############################################################################
"""Database connection support
$Id: Connection.py,v 1.3
2 2000/05/09 19:09:16
jim Exp $"""
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
$Id: Connection.py,v 1.3
3 2000/05/20 15:54:28
jim Exp $"""
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
from
cPickleCache
import
PickleCache
from
POSException
import
ConflictError
,
ExportError
...
...
@@ -439,6 +439,15 @@ class Connection(ExportImport.ExportImport):
error
=
sys
.
exc_info
())
raise
def
oldstate
(
self
,
object
,
serial
):
oid
=
object
.
_p_oid
p
=
self
.
_storage
.
loadSerial
(
oid
,
serial
)
file
=
StringIO
(
p
)
unpickler
=
Unpickler
(
file
)
unpickler
.
persistent_load
=
self
.
_persistent_load
unpickler
.
load
()
return
unpickler
.
load
()
def
setklassstate
(
self
,
object
,
tt
=
type
(()),
ct
=
type
(
HelperClass
)):
try
:
...
...
src/ZODB/FileStorage.py
View file @
2ef8c745
...
...
@@ -184,7 +184,7 @@
# may have a back pointer to a version record or to a non-version
# record.
#
__version__
=
'$Revision: 1.3
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
7
$'
[
11
:
-
2
]
import
struct
,
time
,
os
,
bpthread
,
string
,
base64
,
sys
from
struct
import
pack
,
unpack
...
...
@@ -584,6 +584,34 @@ class FileStorage(BaseStorage.BaseStorage):
try
:
return
self
.
_load
(
oid
,
version
,
self
.
_index
,
self
.
_file
)
finally
:
self
.
_lock_release
()
def
loadSerial
(
self
,
oid
,
serial
):
_index
=
self
.
_index
file
=
self
.
_file
seek
=
file
.
seek
read
=
file
.
read
pos
=
_index
[
oid
]
while
1
:
seek
(
pos
)
h
=
read
(
42
)
doid
,
dserial
,
prev
,
tloc
,
vlen
,
plen
=
unpack
(
">8s8s8s8sH8s"
,
h
)
if
doid
!=
oid
:
raise
CorruptedDataError
,
h
if
dserial
==
serial
:
break
# Yeee ha!
# Keep looking for serial
pos
=
u64
(
prev
)
if
not
pos
:
raise
KeyError
,
serial
continue
if
vlen
:
pnv
=
read
(
8
)
# Read location of non-version data
read
(
8
)
# skip past version link
read
(
vlen
)
# skip version
if
plen
!=
z64
:
return
read
(
u64
(
plen
))
# We got a backpointer, probably from a commit.
pnv
=
read
(
8
)
return
_loadBack
(
file
,
oid
,
pnv
)[
0
]
def
modifiedInVersion
(
self
,
oid
):
self
.
_lock_acquire
()
try
:
...
...
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