loop only on readers once

master
Harshavardhana 10 years ago
parent d9bd5e2e10
commit c366fdd2d8
  1. 4
      pkg/storage/donut/erasure.go

@ -67,9 +67,6 @@ func erasureReader(readers []io.ReadCloser, donutMetadata map[string]string, wri
summer := md5.New()
params, _ := erasure.ParseEncoderParams(uint8(k), uint8(m), technique)
encoder := erasure.NewEncoder(params)
for _, reader := range readers {
defer reader.Close()
}
for i := 0; i < totalChunks; i++ {
curBlockSize := totalLeft
if blockSize < totalLeft {
@ -80,6 +77,7 @@ func erasureReader(readers []io.ReadCloser, donutMetadata map[string]string, wri
encodedBytes := make([][]byte, 16)
for i, reader := range readers {
defer reader.Close()
var bytesBuffer bytes.Buffer
_, err := io.CopyN(&bytesBuffer, reader, int64(curChunkSize))
if err != nil {

Loading…
Cancel
Save