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
bf213313
Commit
bf213313
authored
7 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X client: Cleanup a bit around decompressing
parent
57524491
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
12 deletions
+8
-12
go/neo/client.go
go/neo/client.go
+2
-5
go/neo/internal/xzlib/xzlib.go
go/neo/internal/xzlib/xzlib.go
+2
-5
go/neo/internal/xzlib/xzlib_test.go
go/neo/internal/xzlib/xzlib_test.go
+1
-1
go/neo/storage.go
go/neo/storage.go
+2
-0
go/neo/t/tcpu.go
go/neo/t/tcpu.go
+1
-1
No files found.
go/neo/client.go
View file @
bf213313
...
...
@@ -464,13 +464,10 @@ func (c *Client) _Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, e
}
if
resp
.
Compression
{
// XXX cleanup mess vvv
buf2
:=
mem
.
BufAlloc
(
len
(
buf
.
Data
))
buf2
.
Data
=
buf2
.
Data
[
:
0
]
udata
,
err
:=
xzlib
.
Decompress
(
buf
.
Data
,
buf2
.
Data
)
buf2
:=
&
mem
.
Buf
{
Data
:
nil
}
udata
,
err
:=
xzlib
.
Decompress
(
buf
.
Data
)
buf
.
Release
()
if
err
!=
nil
{
buf2
.
Release
()
return
nil
,
0
,
fmt
.
Errorf
(
"data corrupt: %v"
,
err
)
}
buf2
.
Data
=
udata
...
...
This diff is collapsed.
Click to expand it.
go/neo/internal/xzlib/xzlib.go
View file @
bf213313
...
...
@@ -65,12 +65,9 @@ func Compress(data []byte) (zdata []byte) {
// Decompress decompresses data according to zlib encoding.
//
// out buffer, if there is enough capacity, is used for decompression destination.
// if out has not enough capacity a new buffer is allocated and used.
//
// return: destination buffer with full decompressed data or error.
func
Decompress
(
in
[]
byte
,
out
[]
byte
)
(
data
[]
byte
,
err
error
)
{
return
czlib
.
Decompress
(
in
)
func
Decompress
(
zdata
[]
byte
)
(
data
[]
byte
,
err
error
)
{
return
czlib
.
Decompress
(
zdata
)
}
/*
...
...
This diff is collapsed.
Click to expand it.
go/neo/internal/xzlib/xzlib_test.go
View file @
bf213313
...
...
@@ -38,7 +38,7 @@ var ztestv = []struct{in, out string}{
func
TestDecompress
(
t
*
testing
.
T
)
{
for
_
,
tt
:=
range
ztestv
{
got
,
err
:=
Decompress
([]
byte
(
tt
.
in
)
,
nil
)
got
,
err
:=
Decompress
([]
byte
(
tt
.
in
))
if
err
!=
nil
{
t
.
Errorf
(
"decompress err: %q"
,
tt
.
in
)
continue
...
...
This diff is collapsed.
Click to expand it.
go/neo/storage.go
View file @
bf213313
...
...
@@ -471,6 +471,8 @@ func (stor *Storage) serveLink(ctx context.Context, req *neonet.Request, idReq *
return
err
}
// XXX this go + link.Recv1() in serveClient arrange for N(goroutine) ↑
// with O(1/nreq) rate (i.e. N(goroutine, nreq) ~ ln(nreq)).
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
...
...
This diff is collapsed.
Click to expand it.
go/neo/t/tcpu.go
View file @
bf213313
...
...
@@ -109,7 +109,7 @@ func BenchmarkUnzlib(b *testing.B, zfile string) {
b
.
ResetTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
_
,
err
:=
xzlib
.
Decompress
(
zdata
,
nil
)
_
,
err
:=
xzlib
.
Decompress
(
zdata
)
if
err
!=
nil
{
b
.
Fatal
(
err
)
}
...
...
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