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
2bc466f3
Commit
2bc466f3
authored
Sep 01, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
146534b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
14 deletions
+30
-14
go/neo/client/client.go
go/neo/client/client.go
+2
-0
go/neo/error.go
go/neo/error.go
+2
-2
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+19
-3
go/neo/server/storage.go
go/neo/server/storage.go
+7
-9
No files found.
go/neo/client/client.go
View file @
2bc466f3
...
...
@@ -382,6 +382,8 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
if
err
!=
nil
{
return
nil
,
0
,
err
// XXX err ctx
}
// FIXME ^^^ slink.CloseAccept after really dialed (not to deadlock if
// S decides to send us something)
req
:=
neo
.
GetObject
{
Oid
:
xid
.
Oid
}
if
xid
.
TidBefore
{
...
...
go/neo/error.go
View file @
2bc466f3
...
...
@@ -27,7 +27,7 @@ import (
// XXX place=? -> methods of Error
//
errEncode translates an error into Error packet
//
ErrEncode translates an error into Error packet.
// XXX more text describing relation with zodb errors
func
ErrEncode
(
err
error
)
*
Error
{
switch
err
:=
err
.
(
type
)
{
...
...
@@ -43,7 +43,7 @@ func ErrEncode(err error) *Error {
}
//
errDecode decodes error from Error packet
//
ErrDecode decodes error from Error packet.
// XXX more text describing relation with zodb errors
func
ErrDecode
(
e
*
Error
)
error
{
switch
e
.
Code
{
...
...
go/neo/server/cluster_test.go
View file @
2bc466f3
...
...
@@ -26,6 +26,7 @@ package server
import
(
"bytes"
"context"
"crypto/sha1"
//"io"
"math"
"net"
...
...
@@ -421,7 +422,7 @@ func TestMasterStorage(t *testing.T) {
xwait
(
wg
)
// C starts loading first object
-> connects to S
// C starts loading first object
...
wg
=
&
xsync
.
WorkGroup
{}
xid1
:=
zodb
.
Xid
{
Oid
:
1
,
XTid
:
zodb
.
XTid
{
Tid
:
zodb
.
TidMax
,
TidBefore
:
true
}}
data1
,
serial1
,
err
:=
zstor
.
Load
(
bg
,
xid1
)
...
...
@@ -436,6 +437,7 @@ func TestMasterStorage(t *testing.T) {
}
})
// ... -> connects to S
tc
.
Expect
(
netconnect
(
"c:2"
,
"s:3"
,
"s:1"
))
tc
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
1
,
&
neo
.
RequestIdentification
{
NodeType
:
neo
.
CLIENT
,
...
...
@@ -444,7 +446,6 @@ func TestMasterStorage(t *testing.T) {
ClusterName
:
"abc1"
,
IdTimestamp
:
0
,
// XXX ?
}))
println
(
"222"
)
tc
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
1
,
&
neo
.
AcceptIdentification
{
NodeType
:
neo
.
STORAGE
,
...
...
@@ -454,8 +455,23 @@ func TestMasterStorage(t *testing.T) {
YourUUID
:
neo
.
UUID
(
neo
.
CLIENT
,
1
),
}))
println
(
"333"
)
// ... -> GetObject(xid1)
tc
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
3
,
&
neo
.
GetObject
{
Oid
:
xid1
.
Oid
,
Tid
:
xid1
.
Tid
,
Serial
:
neo
.
INVALID_TID
,
}))
tc
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
3
,
&
neo
.
AnswerGetObject
{
Oid
:
xid1
.
Oid
,
Serial
:
serial1
,
NextSerial
:
0
,
// XXX
Compression
:
false
,
Data
:
data1
,
DataSerial
:
0
,
// XXX
Checksum
:
sha1
.
Sum
(
data1
),
}))
println
(
"444"
)
...
...
go/neo/server/storage.go
View file @
2bc466f3
...
...
@@ -22,6 +22,7 @@ package server
import
(
"context"
"crypto/sha1"
"fmt"
"sync"
"time"
...
...
@@ -111,7 +112,7 @@ func (stor *Storage) Run(ctx context.Context) error {
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
stor
.
serveLink
(
ctx
,
req
,
idReq
)
// XXX ignore err?
stor
.
serveLink
(
ctx
,
req
,
idReq
)
// XXX ignore err?
-> logged
}()
...
...
@@ -394,7 +395,7 @@ func (stor *Storage) serveLink(ctx context.Context, req *neo.Request, idReq *neo
defer
task
.
Runningf
(
&
ctx
,
"serve %s"
,
link
)(
&
err
)
defer
xio
.
CloseWhenDone
(
ctx
,
link
)()
//
handle
identification
//
first process
identification
idResp
,
ok
:=
stor
.
identify
(
idReq
)
if
!
ok
{
reject
(
ctx
,
req
,
idResp
)
// XXX log?
...
...
@@ -449,13 +450,10 @@ func (stor *Storage) serveClient(ctx context.Context, req neo.Request) {
return
}
//lclose(ctx, conn)
// keep on going in the same goroutine to avoid goroutine creation overhead
// TODO += timeout -> go away if inactive
req
,
err
=
link
.
Recv1
()
if
err
!=
nil
{
// lclose(link) XXX ?
log
.
Error
(
ctx
,
err
)
return
}
...
...
@@ -477,7 +475,7 @@ func (stor *Storage) serveClient1(ctx context.Context, req neo.Msg) (resp neo.Ms
data
,
tid
,
err
:=
stor
.
zstor
.
Load
(
ctx
,
xid
)
if
err
!=
nil
{
//
TODO
translate err to NEO protocol error codes
// translate err to NEO protocol error codes
return
neo
.
ErrEncode
(
err
)
}
...
...
@@ -485,9 +483,9 @@ func (stor *Storage) serveClient1(ctx context.Context, req neo.Msg) (resp neo.Ms
Oid
:
xid
.
Oid
,
Serial
:
tid
,
Compression
:
false
,
Data
:
data
,
// XXX .CheckSum
Compression
:
false
,
Data
:
data
,
Checksum
:
sha1
.
Sum
(
data
),
// XXX computing every time
// XXX .NextSerial
// XXX .DataSerial
...
...
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