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
18b22971
Commit
18b22971
authored
Jul 09, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
51e5b8b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+10
-14
No files found.
go/zodb/storage/zeo/zeo.go
View file @
18b22971
...
...
@@ -23,7 +23,6 @@ package zeo
import
(
"context"
"fmt"
"log"
"net/url"
"strings"
"sync"
...
...
@@ -113,28 +112,31 @@ func (z *zeo) Iterate(ctx context.Context, tidMin, tidMax zodb.Tid) zodb.ITxnIte
// invalidateTransaction receives invalidations from server
func
(
z
*
zeo
)
invalidateTransaction
(
arg
interface
{})
error
{
func
(
z
*
zeo
)
invalidateTransaction
(
arg
interface
{})
(
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"invalidateTransaction"
)
t
,
ok
:=
z
.
srv
.
asTuple
(
arg
)
if
!
ok
||
len
(
t
)
!=
2
{
return
XXX
(
"got %#v; expect 2-tuple"
,
arg
)
return
fmt
.
Errorf
(
"got %#v; expect 2-tuple"
,
arg
)
}
// (tid, oidv)
tid
,
ok1
:=
z
.
srv
.
tidUnpack
(
t
[
0
])
xoidt
,
ok2
:=
z
.
srv
.
asTuple
(
t
[
1
])
if
!
(
ok1
&&
ok2
)
{
return
XXX
(
"got (%T, %T); expect (tid, []oid)"
)
return
fmt
.
Errorf
(
"got (%T, %T); expect (tid, []oid)"
,
t
...
)
}
oidv
:=
[]
zodb
.
Oid
{}
for
_
,
xoid
:=
range
xoidt
{
oid
,
ok
:=
z
.
srv
.
oidUnpack
(
xoid
)
if
!
ok
{
return
XXX
(
"non-oid %#v in oidv"
,
xoid
)
return
fmt
.
Errorf
(
"non-oid %#v in oidv"
,
xoid
)
}
oidv
=
append
(
oidv
,
oid
)
}
if
tid
<=
z
.
head
{
return
XXX
(
"bad invalidation from server: tid not ↑: %s -> %s"
,
z
.
head
,
tid
)
return
fmt
.
Errorf
(
"bad invalidation from server: tid not ↑: %s -> %s"
,
z
.
head
,
tid
)
}
z
.
head
=
tid
...
...
@@ -142,6 +144,7 @@ func (z *zeo) invalidateTransaction(arg interface{}) error {
return
nil
}
// invalidation event received and we have to send it to .watchq
event
:=
&
zodb
.
EventCommit
{
Tid
:
tid
,
Changev
:
oidv
}
z
.
at0Mu
.
Lock
()
...
...
@@ -379,13 +382,6 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
return
nil
,
zodb
.
InvalidTid
,
fmt
.
Errorf
(
"TODO write mode not implemented"
)
}
// FIXME handle opt.Watchq
// for now we pretend as if the database is not changing.
if
opt
.
Watchq
!=
nil
{
log
.
Print
(
"zeo: FIXME: watchq support not implemented - there "
+
"won't be notifications about database changes"
)
}
zl
,
err
:=
dialZLink
(
ctx
,
net
,
addr
)
// XXX + methodTable {invalidateTransaction tid, oidv} -> ...
if
err
!=
nil
{
return
nil
,
zodb
.
InvalidTid
,
err
...
...
@@ -416,7 +412,7 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
}
}
lastTid
,
ok
:=
zl
.
tidUnpack
(
xlastTid
)
// XXX -> xlastTid -> scan
lastTid
,
ok
:=
zl
.
tidUnpack
(
xlastTid
)
if
!
ok
{
return
nil
,
zodb
.
InvalidTid
,
rpc
.
ereplyf
(
"got %v; expect tid"
,
xlastTid
)
}
...
...
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