swarm: remove unused/dead code (#18351)

This commit is contained in:
Anton Evangelatov
2018-12-23 17:31:32 +01:00
committed by GitHub
parent 335760bf06
commit 9e9fc87e70
25 changed files with 19 additions and 400 deletions

View File

@ -65,10 +65,6 @@ If all is well it is possible to implement this by simply composing readers so t
The hashing itself does use extra copies and allocation though, since it does need it.
*/
var (
errAppendOppNotSuported = errors.New("Append operation not supported")
)
type ChunkerParams struct {
chunkSize int64
hashSize int64
@ -99,7 +95,6 @@ type TreeChunker struct {
ctx context.Context
branches int64
hashFunc SwarmHasher
dataSize int64
data io.Reader
// calculated
@ -365,10 +360,6 @@ func (tc *TreeChunker) runWorker(ctx context.Context) {
}()
}
func (tc *TreeChunker) Append() (Address, func(), error) {
return nil, nil, errAppendOppNotSuported
}
// LazyChunkReader implements LazySectionReader
type LazyChunkReader struct {
ctx context.Context
@ -411,7 +402,6 @@ func (r *LazyChunkReader) Size(ctx context.Context, quitC chan bool) (n int64, e
log.Debug("lazychunkreader.size", "addr", r.addr)
if r.chunkData == nil {
startTime := time.Now()
chunkData, err := r.getter.Get(cctx, Reference(r.addr))
if err != nil {
@ -420,13 +410,8 @@ func (r *LazyChunkReader) Size(ctx context.Context, quitC chan bool) (n int64, e
}
metrics.GetOrRegisterResettingTimer("lcr.getter.get", nil).UpdateSince(startTime)
r.chunkData = chunkData
s := r.chunkData.Size()
log.Debug("lazychunkreader.size", "key", r.addr, "size", s)
if s < 0 {
return 0, errors.New("corrupt size")
}
return int64(s), nil
}
s := r.chunkData.Size()
log.Debug("lazychunkreader.size", "key", r.addr, "size", s)