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
d3bb1868
Commit
d3bb1868
authored
Jul 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb/zeo: Cosmetics
parent
149187b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
go/zodb/storage/zeo/proto.go
go/zodb/storage/zeo/proto.go
+3
-2
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+10
-3
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+5
-4
No files found.
go/zodb/storage/zeo/proto.go
View file @
d3bb1868
...
...
@@ -305,7 +305,7 @@ func (e encoding) asTuple(xt interface{}) (tuple, bool) {
}
// xuint64Unpack tries to
decode packed 8-byte string as bigendian uint64
// xuint64Unpack tries to
retrieve packed 8-byte string as bigendian uint64.
func
(
e
encoding
)
xuint64Unpack
(
xv
interface
{})
(
uint64
,
bool
)
{
switch
e
{
default
:
...
...
@@ -332,9 +332,10 @@ func (e encoding) xuint64Unpack(xv interface{}) (uint64, bool) {
return
binary
.
BigEndian
.
Uint64
(
v
),
true
}
}
}
// xuint64Pack packs v into big-endian 8-byte string
// xuint64Pack packs v into big-endian 8-byte string
.
func
(
e
encoding
)
xuint64Pack
(
v
uint64
)
interface
{}
{
var
b
[
8
]
byte
binary
.
BigEndian
.
PutUint64
(
b
[
:
],
v
)
...
...
go/zodb/storage/zeo/zeo.go
View file @
d3bb1868
...
...
@@ -35,6 +35,7 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
)
// zeo provides ZEO client.
type
zeo
struct
{
link
*
zLink
...
...
@@ -51,7 +52,11 @@ 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
)
{
defer
func
()
{
if
err
!=
nil
{
...
...
@@ -75,6 +80,7 @@ func (z *zeo) Sync(ctx context.Context) (head zodb.Tid, err error) {
return
head
,
nil
}
// Load implements zodb.IStorageDriver.
func
(
z
*
zeo
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
buf
*
mem
.
Buf
,
serial
zodb
.
Tid
,
err
error
)
{
defer
func
()
{
if
err
!=
nil
{
...
...
@@ -106,6 +112,7 @@ func (z *zeo) Load(ctx context.Context, xid zodb.Xid) (buf *mem.Buf, serial zodb
return
&
mem
.
Buf
{
Data
:
data
},
serial
,
nil
}
// Iterates implements zodb.IStorageDriver.
func
(
z
*
zeo
)
Iterate
(
ctx
context
.
Context
,
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
ITxnIterator
{
panic
(
"TODO"
)
}
...
...
@@ -204,7 +211,7 @@ 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
{
zlink
:
z
.
link
,
method
:
method
}
}
...
...
@@ -214,7 +221,7 @@ type rpc struct {
method
string
}
// rpcExcept represents generic exception
// rpcExcept represents generic exception
.
type
rpcExcept
struct
{
exc
string
argv
tuple
...
...
@@ -464,7 +471,7 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
}
}
lastTid
,
ok
:=
zlink
.
enc
.
asTid
(
xlastTid
)
// XXX -> xlastTid -> scan
lastTid
,
ok
:=
zlink
.
enc
.
asTid
(
xlastTid
)
if
!
ok
{
return
nil
,
zodb
.
InvalidTid
,
rpc
.
ereplyf
(
"got %v; expect tid"
,
xlastTid
)
}
...
...
go/zodb/storage/zeo/zrpc.go
View file @
d3bb1868
...
...
@@ -37,13 +37,11 @@ import (
"lab.nexedi.com/kirr/go123/xsync"
)
const
pktHeaderLen
=
4
// we can speak this protocol versions
var
protoVersions
=
[]
string
{
"3101"
,
// last in ZEO3 series
"4"
,
// no longer call load.
"5"
,
// current in ZEO5 series.
"5"
,
// current in ZEO5 series
(no serialnos, ...)
.
}
...
...
@@ -309,6 +307,9 @@ func (zl *zLink) reply(msgid int64, res interface{}) (err error) {
// ---- raw IO ----
// packet = {size(u32), data}
const
pktHeaderLen
=
4
// pktBuf is buffer with packet data.
//
// alloc via allocPkb and free via pkb.Free.
...
...
@@ -376,7 +377,7 @@ func (zl *zLink) sendPkt(pkb *pktBuf) error {
// recvPkt receives 1 raw ZEO packet.
//
// the packet returned contains both header and payload.
// XXX almost du
m
p from NEO.
// XXX almost dup from NEO.
func
(
zl
*
zLink
)
recvPkt
()
(
*
pktBuf
,
error
)
{
pkb
:=
allocPkb
()
data
:=
pkb
.
data
[
:
cap
(
pkb
.
data
)]
...
...
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