Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
Commits
68287a90
Commit
68287a90
authored
Jul 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3d19dd3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+11
-4
No files found.
go/zodb/storage/zeo/zeo.go
View file @
68287a90
...
...
@@ -36,7 +36,6 @@ import (
)
// zeo provides ZEO client.
// It implements zodb.IStorageDriver.
type
zeo
struct
{
link
*
zLink
...
...
@@ -53,6 +52,9 @@ type zeo struct {
url
string
// we were opened via this
}
// zeo implements zodb.IStorageDriver.
var
_
zodb
.
IStorageDriver
=
(
*
zeo
)(
nil
)
// Sync implements zodb.IStorageDriver.
func
(
z
*
zeo
)
Sync
(
ctx
context
.
Context
)
(
head
zodb
.
Tid
,
err
error
)
{
...
...
@@ -73,6 +75,8 @@ func (z *zeo) Sync(ctx context.Context) (head zodb.Tid, err error) {
return
zodb
.
InvalidTid
,
rpc
.
ereplyf
(
"got %v; expect tid"
,
xhead
)
}
// no need to verify that head↑ - IStorage.Sync does it.
// no need to wait till .watchq is notified till head] - IStorage.Sync does it.
return
head
,
nil
}
...
...
@@ -116,20 +120,20 @@ func (z *zeo) Iterate(ctx context.Context, tidMin, tidMax zodb.Tid) zodb.ITxnIte
// invalidateTransaction receives invalidations from server.
func
(
z
*
zeo
)
invalidateTransaction
(
arg
interface
{})
(
err
error
)
{
// (tid, oidv)
enc
:=
z
.
link
.
enc
t
,
ok
:=
enc
.
asTuple
(
arg
)
if
!
ok
||
len
(
t
)
!=
2
{
return
fmt
.
Errorf
(
"got %#v; expect 2-tuple"
,
arg
)
}
// (tid, oidv)
tid
,
ok1
:=
enc
.
asTid
(
t
[
0
])
xoid
t
,
ok2
:=
enc
.
asTuple
(
t
[
1
])
xoid
v
,
ok2
:=
enc
.
asTuple
(
t
[
1
])
if
!
(
ok1
&&
ok2
)
{
return
fmt
.
Errorf
(
"got (%T, %T); expect (tid, []oid)"
,
t
...
)
}
oidv
:=
[]
zodb
.
Oid
{}
for
_
,
xoid
:=
range
xoid
t
{
for
_
,
xoid
:=
range
xoid
v
{
oid
,
ok
:=
enc
.
asOid
(
xoid
)
if
!
ok
{
return
fmt
.
Errorf
(
"non-oid %#v in oidv"
,
xoid
)
...
...
@@ -137,6 +141,9 @@ func (z *zeo) invalidateTransaction(arg interface{}) (err error) {
oidv
=
append
(
oidv
,
oid
)
}
// likely no need to verify for tid↑ because IStorage watcher does it.
// However until .at0 is initialized we do not send events to IStorage,
// so double check for monotonicity here as well.
if
tid
<=
z
.
head
{
return
fmt
.
Errorf
(
"bad invalidation from server: tid not ↑: %s -> %s"
,
z
.
head
,
tid
)
}
...
...
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