Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
1fe432e9
Commit
1fe432e9
authored
Jul 14, 2020
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
...
@@ -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
{
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
{
type
rpc
struct
{
zl
*
zLink
zl
ink
*
zLink
method
string
method
string
}
}
// rpcExcept represents generic exception
// rpcExcept represents generic exception
.
type
rpcExcept
struct
{
type
rpcExcept
struct
{
exc
string
exc
string
argv
tuple
argv
tuple
...
@@ -232,12 +232,12 @@ func (r *rpcExcept) Error() string {
...
@@ -232,12 +232,12 @@ func (r *rpcExcept) Error() string {
}
}
func
(
r
rpc
)
call
(
ctx
context
.
Context
,
argv
...
interface
{})
(
interface
{},
error
)
{
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
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
r
.
zl
.
ver
>=
"5"
{
if
r
.
zl
ink
.
ver
>=
"5"
{
// in ZEO5 exceptions are marked via flag
// in ZEO5 exceptions are marked via flag
if
reply
.
flags
&
msgExcept
!=
0
{
if
reply
.
flags
&
msgExcept
!=
0
{
return
nil
,
r
.
zeo5Error
(
reply
.
arg
)
return
nil
,
r
.
zeo5Error
(
reply
.
arg
)
...
@@ -268,7 +268,7 @@ func (r rpc) excError(exc string, argv tuple) error {
...
@@ -268,7 +268,7 @@ func (r rpc) excError(exc string, argv tuple) error {
return
r
.
ereplyf
(
"poskeyerror: got %#v; expect 1-tuple"
,
argv
...
)
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
{
if
!
ok
{
return
r
.
ereplyf
(
"poskeyerror: got (%v); expect (oid)"
,
argv
[
0
])
return
r
.
ereplyf
(
"poskeyerror: got (%v); expect (oid)"
,
argv
[
0
])
}
}
...
@@ -286,7 +286,7 @@ func (r rpc) excError(exc string, argv tuple) error {
...
@@ -286,7 +286,7 @@ func (r rpc) excError(exc string, argv tuple) error {
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// corresponding error.
// corresponding error.
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
enc
:=
r
.
zl
.
enc
enc
:=
r
.
zl
ink
.
enc
// ('type', (arg1, arg2, arg3, ...))
// ('type', (arg1, arg2, arg3, ...))
texc
,
ok
:=
enc
.
asTuple
(
arg
)
texc
,
ok
:=
enc
.
asTuple
(
arg
)
if
!
ok
||
len
(
texc
)
!=
2
{
if
!
ok
||
len
(
texc
)
!=
2
{
...
@@ -308,7 +308,7 @@ func (r rpc) zeo5Error(arg interface{}) error {
...
@@ -308,7 +308,7 @@ func (r rpc) zeo5Error(arg interface{}) error {
// nil is returned if arg does not represent an exception.
// nil is returned if arg does not represent an exception.
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
// in non-pickle encodings errors are always indicated via msgExcept flag
// in non-pickle encodings errors are always indicated via msgExcept flag
if
r
.
zl
.
enc
!=
'Z'
{
if
r
.
zl
ink
.
enc
!=
'Z'
{
return
nil
return
nil
}
}
...
@@ -380,7 +380,7 @@ func isPyExceptClass(klass pickle.Class) bool {
...
@@ -380,7 +380,7 @@ func isPyExceptClass(klass pickle.Class) bool {
}
}
func
(
r
rpc
)
ereplyf
(
format
string
,
argv
...
interface
{})
*
errorUnexpectedReply
{
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
...
@@ -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"
)
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
{
if
err
!=
nil
{
return
nil
,
zodb
.
InvalidTid
,
err
return
nil
,
zodb
.
InvalidTid
,
err
}
}
defer
func
()
{
defer
func
()
{
if
err
!=
nil
{
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
// start serve loop on the link
z
.
serveWG
.
Add
(
1
)
z
.
serveWG
.
Add
(
1
)
go
func
()
{
go
func
()
{
defer
z
.
serveWG
.
Done
()
defer
z
.
serveWG
.
Done
()
err
:=
zl
.
Serve
(
err
:=
zl
ink
.
Serve
(
// notifyTab
// notifyTab
map
[
string
]
func
(
interface
{})
error
{
map
[
string
]
func
(
interface
{})
error
{
"invalidateTransaction"
:
z
.
invalidateTransaction
,
"invalidateTransaction"
:
z
.
invalidateTransaction
,
...
@@ -470,7 +470,7 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
...
@@ -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
{
if
!
ok
{
return
nil
,
zodb
.
InvalidTid
,
rpc
.
ereplyf
(
"got %v; expect tid"
,
xlastTid
)
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