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
0e6a7bb5
Commit
0e6a7bb5
authored
Aug 30, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
050a3de8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
go/neo/client/client.go
go/neo/client/client.go
+5
-4
No files found.
go/neo/client/client.go
View file @
0e6a7bb5
...
@@ -345,7 +345,7 @@ func (c *Client) LastOid(ctx context.Context) (zodb.Oid, error) {
...
@@ -345,7 +345,7 @@ func (c *Client) LastOid(ctx context.Context) (zodb.Oid, error) {
func
(
c
*
Client
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
data
[]
byte
,
serial
zodb
.
Tid
,
err
error
)
{
func
(
c
*
Client
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
data
[]
byte
,
serial
zodb
.
Tid
,
err
error
)
{
// XXX err context (but keep zodb errors intact ?)
// XXX err context (but keep zodb errors intact ?)
defer
xerr
.
Context
(
&
err
,
"client: load"
)
defer
xerr
.
Context
f
(
&
err
,
"client: load %v"
,
xid
)
err
=
c
.
withOperational
(
ctx
)
err
=
c
.
withOperational
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -372,7 +372,8 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
...
@@ -372,7 +372,8 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
}
}
// XXX vvv temp stub -> TODO pick up 3 random storages and send load
// XXX vvv temp stub -> TODO pick up 3 random storages and send load
// requests to them all getting the first who is the fastest to reply.
// requests to them all getting the first who is the fastest to reply;
// retry from the beginning if all are found to fail?
stor
:=
storv
[
rand
.
Intn
(
len
(
storv
))]
stor
:=
storv
[
rand
.
Intn
(
len
(
storv
))]
slink
:=
stor
.
Link
// XXX temp stub
slink
:=
stor
.
Link
// XXX temp stub
...
@@ -398,14 +399,14 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
...
@@ -398,14 +399,14 @@ func (c *Client) Load(ctx context.Context, xid zodb.Xid) (data []byte, serial zo
checksum
:=
sha1
.
Sum
(
data
)
checksum
:=
sha1
.
Sum
(
data
)
if
checksum
!=
resp
.
Checksum
{
if
checksum
!=
resp
.
Checksum
{
panic
(
"TODO"
)
// XXX data corrupt
return
nil
,
0
,
fmt
.
Errorf
(
"data corrupt: checksum mismatch"
)
}
}
data
=
resp
.
Data
data
=
resp
.
Data
if
resp
.
Compression
{
if
resp
.
Compression
{
data
,
err
=
decompress
(
resp
.
Data
,
make
([]
byte
,
0
,
len
(
resp
.
Data
)))
data
,
err
=
decompress
(
resp
.
Data
,
make
([]
byte
,
0
,
len
(
resp
.
Data
)))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
"TODO"
)
// XXX data corrupt
return
nil
,
0
,
fmt
.
Errorf
(
"data corrupt: %v"
,
err
)
}
}
}
}
...
...
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