Skip to content

Commit ac297a8

Browse files
committed
chore: block/blockstoreutil remove unused ProcRmOutput function
1 parent f72110c commit ac297a8

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

blocks/blockstoreutil/remove.go

-28
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"errors"
77
"fmt"
8-
"io"
98

109
cid "github.com/ipfs/go-cid"
1110
bs "github.com/ipfs/go-ipfs-blockstore"
@@ -95,30 +94,3 @@ func FilterPinned(ctx context.Context, pins pin.Pinner, out chan<- interface{},
9594
}
9695
return stillOkay
9796
}
98-
99-
// ProcRmOutput takes a function which returns a result from RmBlocks or EOF if there is no input.
100-
// It then writes to stdout/stderr according to the RemovedBlock object returned from the function.
101-
func ProcRmOutput(next func() (interface{}, error), sout io.Writer, serr io.Writer) error {
102-
someFailed := false
103-
for {
104-
res, err := next()
105-
if err == io.EOF {
106-
break
107-
} else if err != nil {
108-
return err
109-
}
110-
r := res.(*RemovedBlock)
111-
if r.Hash == "" && r.Error != nil {
112-
return fmt.Errorf("aborted: %w", r.Error)
113-
} else if r.Error != nil {
114-
someFailed = true
115-
fmt.Fprintf(serr, "cannot remove %s: %v\n", r.Hash, r.Error)
116-
} else {
117-
fmt.Fprintf(sout, "removed %s\n", r.Hash)
118-
}
119-
}
120-
if someFailed {
121-
return fmt.Errorf("some blocks not removed")
122-
}
123-
return nil
124-
}

0 commit comments

Comments
 (0)