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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
neoppod
Commits
1fe432e9
Commit
1fe432e9
authored
4 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
68287a90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+15
-15
No files found.
go/zodb/storage/zeo/zeo.go
View file @
1fe432e9
...
...
@@ -211,17 +211,17 @@ func ereplyf(addr, method, format string, argv ...interface{}) *errorUnexpectedR
}
}
// rpc returns rpc object handy to make calls/create errors
// rpc returns rpc object handy to make calls/create errors
.
func
(
z
*
zeo
)
rpc
(
method
string
)
rpc
{
return
rpc
{
zl
:
z
.
link
,
method
:
method
}
return
rpc
{
zl
ink
:
z
.
link
,
method
:
method
}
}
type
rpc
struct
{
zl
*
zLink
zl
ink
*
zLink
method
string
}
// rpcExcept represents generic exception
// rpcExcept represents generic exception
.
type
rpcExcept
struct
{
exc
string
argv
tuple
...
...
@@ -232,12 +232,12 @@ func (r *rpcExcept) Error() string {
}
func
(
r
rpc
)
call
(
ctx
context
.
Context
,
argv
...
interface
{})
(
interface
{},
error
)
{
reply
,
err
:=
r
.
zl
.
Call
(
ctx
,
r
.
method
,
argv
...
)
reply
,
err
:=
r
.
zl
ink
.
Call
(
ctx
,
r
.
method
,
argv
...
)
if
err
!=
nil
{
return
nil
,
err
}
if
r
.
zl
.
ver
>=
"5"
{
if
r
.
zl
ink
.
ver
>=
"5"
{
// in ZEO5 exceptions are marked via flag
if
reply
.
flags
&
msgExcept
!=
0
{
return
nil
,
r
.
zeo5Error
(
reply
.
arg
)
...
...
@@ -268,7 +268,7 @@ func (r rpc) excError(exc string, argv tuple) error {
return
r
.
ereplyf
(
"poskeyerror: got %#v; expect 1-tuple"
,
argv
...
)
}
oid
,
ok
:=
r
.
zl
.
enc
.
asOid
(
argv
[
0
])
oid
,
ok
:=
r
.
zl
ink
.
enc
.
asOid
(
argv
[
0
])
if
!
ok
{
return
r
.
ereplyf
(
"poskeyerror: got (%v); expect (oid)"
,
argv
[
0
])
}
...
...
@@ -286,7 +286,7 @@ func (r rpc) excError(exc string, argv tuple) error {
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// corresponding error.
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
enc
:=
r
.
zl
.
enc
enc
:=
r
.
zl
ink
.
enc
// ('type', (arg1, arg2, arg3, ...))
texc
,
ok
:=
enc
.
asTuple
(
arg
)
if
!
ok
||
len
(
texc
)
!=
2
{
...
...
@@ -308,7 +308,7 @@ func (r rpc) zeo5Error(arg interface{}) error {
// nil is returned if arg does not represent an exception.
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
// in non-pickle encodings errors are always indicated via msgExcept flag
if
r
.
zl
.
enc
!=
'Z'
{
if
r
.
zl
ink
.
enc
!=
'Z'
{
return
nil
}
...
...
@@ -380,7 +380,7 @@ func isPyExceptClass(klass pickle.Class) bool {
}
func
(
r
rpc
)
ereplyf
(
format
string
,
argv
...
interface
{})
*
errorUnexpectedReply
{
return
ereplyf
(
r
.
zl
.
link
.
RemoteAddr
()
.
String
(),
r
.
method
,
format
,
argv
...
)
return
ereplyf
(
r
.
zl
ink
.
link
.
RemoteAddr
()
.
String
(),
r
.
method
,
format
,
argv
...
)
}
...
...
@@ -413,25 +413,25 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
return
nil
,
zodb
.
InvalidTid
,
fmt
.
Errorf
(
"TODO write mode not implemented"
)
}
zl
,
err
:=
dialZLink
(
ctx
,
net
,
addr
)
zl
ink
,
err
:=
dialZLink
(
ctx
,
net
,
addr
)
if
err
!=
nil
{
return
nil
,
zodb
.
InvalidTid
,
err
}
defer
func
()
{
if
err
!=
nil
{
zl
.
Close
()
zl
ink
.
Close
()
}
}()
z
:=
&
zeo
{
link
:
zl
,
watchq
:
opt
.
Watchq
,
url
:
url
}
z
:=
&
zeo
{
link
:
zl
ink
,
watchq
:
opt
.
Watchq
,
url
:
url
}
// start serve loop on the link
z
.
serveWG
.
Add
(
1
)
go
func
()
{
defer
z
.
serveWG
.
Done
()
err
:=
zl
.
Serve
(
err
:=
zl
ink
.
Serve
(
// notifyTab
map
[
string
]
func
(
interface
{})
error
{
"invalidateTransaction"
:
z
.
invalidateTransaction
,
...
...
@@ -470,7 +470,7 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
}
}
lastTid
,
ok
:=
zl
.
enc
.
asTid
(
xlastTid
)
lastTid
,
ok
:=
zl
ink
.
enc
.
asTid
(
xlastTid
)
if
!
ok
{
return
nil
,
zodb
.
InvalidTid
,
rpc
.
ereplyf
(
"got %v; expect tid"
,
xlastTid
)
}
...
...
This diff is collapsed.
Click to expand it.
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