Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
222445c9
Commit
222445c9
authored
Nov 15, 2015
by
rht
Committed by
Jeromy
Jan 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove chunk channels
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
90f6f5f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
mod/dagmodifier.go
mod/dagmodifier.go
+4
-6
No files found.
mod/dagmodifier.go
View file @
222445c9
...
@@ -103,8 +103,7 @@ func (zr zeroReader) Read(b []byte) (int, error) {
...
@@ -103,8 +103,7 @@ func (zr zeroReader) Read(b []byte) (int, error) {
func
(
dm
*
DagModifier
)
expandSparse
(
size
int64
)
error
{
func
(
dm
*
DagModifier
)
expandSparse
(
size
int64
)
error
{
r
:=
io
.
LimitReader
(
zeroReader
{},
size
)
r
:=
io
.
LimitReader
(
zeroReader
{},
size
)
spl
:=
chunk
.
NewSizeSplitter
(
r
,
4096
)
spl
:=
chunk
.
NewSizeSplitter
(
r
,
4096
)
blks
,
errs
:=
chunk
.
Chan
(
spl
)
nnode
,
err
:=
dm
.
appendData
(
dm
.
curNode
,
spl
)
nnode
,
err
:=
dm
.
appendData
(
dm
.
curNode
,
blks
,
errs
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -191,8 +190,7 @@ func (dm *DagModifier) Sync() error {
...
@@ -191,8 +190,7 @@ func (dm *DagModifier) Sync() error {
// need to write past end of current dag
// need to write past end of current dag
if
!
done
{
if
!
done
{
blks
,
errs
:=
chunk
.
Chan
(
dm
.
splitter
(
dm
.
wrBuf
))
nd
,
err
=
dm
.
appendData
(
dm
.
curNode
,
dm
.
splitter
(
dm
.
wrBuf
))
nd
,
err
=
dm
.
appendData
(
dm
.
curNode
,
blks
,
errs
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -286,13 +284,13 @@ func (dm *DagModifier) modifyDag(node *mdag.Node, offset uint64, data io.Reader)
...
@@ -286,13 +284,13 @@ func (dm *DagModifier) modifyDag(node *mdag.Node, offset uint64, data io.Reader)
}
}
// appendData appends the blocks from the given chan to the end of this dag
// appendData appends the blocks from the given chan to the end of this dag
func
(
dm
*
DagModifier
)
appendData
(
node
*
mdag
.
Node
,
blks
<-
chan
[]
byte
,
errs
<-
chan
erro
r
)
(
*
mdag
.
Node
,
error
)
{
func
(
dm
*
DagModifier
)
appendData
(
node
*
mdag
.
Node
,
spl
chunk
.
Splitte
r
)
(
*
mdag
.
Node
,
error
)
{
dbp
:=
&
help
.
DagBuilderParams
{
dbp
:=
&
help
.
DagBuilderParams
{
Dagserv
:
dm
.
dagserv
,
Dagserv
:
dm
.
dagserv
,
Maxlinks
:
help
.
DefaultLinksPerBlock
,
Maxlinks
:
help
.
DefaultLinksPerBlock
,
}
}
return
trickle
.
TrickleAppend
(
dm
.
ctx
,
node
,
dbp
.
New
(
blks
,
errs
))
return
trickle
.
TrickleAppend
(
dm
.
ctx
,
node
,
dbp
.
New
(
spl
))
}
}
// Read data from this dag starting at the current offset
// Read data from this dag starting at the current offset
...
...
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