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
f1350548
Commit
f1350548
authored
Jun 16, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the ltid in the cache header to determine the most recent cache.
parent
a7a571a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
src/ZEO/ClientCache.py
src/ZEO/ClientCache.py
+12
-14
No files found.
src/ZEO/ClientCache.py
View file @
f1350548
...
...
@@ -115,7 +115,7 @@ import tempfile
from
struct
import
pack
,
unpack
from
thread
import
allocate_lock
from
ZODB.utils
import
oid_repr
from
ZODB.utils
import
oid_repr
,
u64
,
z64
import
zLOG
from
ZEO.ICache
import
ICache
...
...
@@ -155,20 +155,19 @@ class ClientCache:
# Initialize pairs of filenames, file objects, and serialnos.
self
.
_p
=
p
=
[
fmt
%
0
,
fmt
%
1
]
self
.
_f
=
f
=
[
None
,
None
]
s
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
self
.
_current
=
0
s
=
[
z64
,
z64
]
for
i
in
0
,
1
:
if
os
.
path
.
exists
(
p
[
i
]):
fi
=
open
(
p
[
i
],
'r+b'
)
if
fi
.
read
(
4
)
==
magic
:
# Minimal sanity
fi
.
seek
(
0
,
2
)
if
fi
.
tell
()
>
headersize
:
# Read serial at offset 19 of first record
fi
.
seek
(
headersize
+
19
)
s
[
i
]
=
fi
.
read
(
8
)
# Read the ltid for this file. If it never
# saw a transaction commit, it will get tossed,
# even if it has valid data.
s
[
i
]
=
fi
.
read
(
8
)
# If we found a non-zero serial, then use the file
if
s
[
i
]
!=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
:
if
s
[
i
]
!=
z64
:
f
[
i
]
=
fi
fi
=
None
# Whoever has the larger serial is the current
if
s
[
1
]
>
s
[
0
]:
...
...
@@ -250,8 +249,7 @@ class ClientCache:
f
=
self
.
_f
[
self
.
_current
]
f
.
seek
(
4
)
tid
=
f
.
read
(
8
)
self
.
log
(
"reading ltid %r"
%
tid
)
if
len
(
tid
)
<
8
or
tid
==
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
:
if
len
(
tid
)
<
8
or
tid
==
z64
:
return
None
else
:
return
tid
...
...
@@ -263,7 +261,7 @@ class ClientCache:
cache file; otherwise it's an instance variable.
"""
if
self
.
_client
is
None
:
if
tid
==
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
:
if
tid
==
z64
:
tid
=
None
self
.
_ltid
=
tid
else
:
...
...
@@ -275,7 +273,7 @@ class ClientCache:
def
_setLastTid
(
self
,
tid
):
if
tid
is
None
:
tid
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
tid
=
z64
else
:
tid
=
str
(
tid
)
assert
len
(
tid
)
==
8
...
...
@@ -597,7 +595,7 @@ class ClientCache:
def
_store
(
self
,
oid
,
p
,
s
,
version
,
pv
,
sv
):
if
not
s
:
p
=
''
s
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
s
=
z64
tlen
=
31
+
len
(
oid
)
+
len
(
p
)
if
version
:
tlen
=
tlen
+
len
(
version
)
+
12
+
len
(
pv
)
...
...
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