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-dms3-blockstore
Commits
6593a208
Commit
6593a208
authored
Apr 01, 2017
by
Jan Winkelmann
Committed by
keks
Nov 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: use go-ipfs-cmds
License: MIT Signed-off-by:
keks
<
keks@cryptoscope.co
>
parent
b5f4f310
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
caching.go
caching.go
+1
-0
util/remove.go
util/remove.go
+10
-5
No files found.
caching.go
View file @
6593a208
...
...
@@ -4,6 +4,7 @@ import (
"errors"
context
"context"
"gx/ipfs/QmRg1gKTHzc3CZXSKzem8aR4E3TubFhbgXwfVuWnSK5CC5/go-metrics-interface"
)
...
...
util/remove.go
View file @
6593a208
...
...
@@ -85,12 +85,17 @@ func FilterPinned(pins pin.Pinner, out chan<- interface{}, cids []*cid.Cid) []*c
return
stillOkay
}
// ProcRmOutput takes the channel returned by RmBlocks and writes
// to stdout/stderr according to the RemovedBlock objects received in
// that channel.
func
ProcRmOutput
(
in
<-
chan
interface
{},
sout
io
.
Writer
,
serr
io
.
Writer
)
error
{
// ProcRmOutput takes a function which returns a result from RmBlocks or EOF if there is no input.
// It then writes to stdout/stderr according to the RemovedBlock object returned from the function.
func
ProcRmOutput
(
next
func
()
(
interface
{},
error
),
sout
io
.
Writer
,
serr
io
.
Writer
)
error
{
someFailed
:=
false
for
res
:=
range
in
{
for
{
res
,
err
:=
next
()
if
err
==
io
.
EOF
{
break
}
else
if
err
!=
nil
{
return
err
}
r
:=
res
.
(
*
RemovedBlock
)
if
r
.
Hash
==
""
&&
r
.
Error
!=
""
{
return
fmt
.
Errorf
(
"aborted: %s"
,
r
.
Error
)
...
...
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