Group erasure shares before sending them to storage nodes (#210)

This commit is contained in:
Kaloyan Raev 2018-08-09 18:14:05 +03:00 committed by Alexander Leitner
parent 80c0a0ed2b
commit 34629e5b80

View File

@ -4,6 +4,7 @@
package client
import (
"bufio"
"fmt"
"io"
"log"
@ -76,10 +77,13 @@ func (client *Client) Put(ctx context.Context, id PieceID, data io.Reader, ttl t
}
}()
_, err = io.Copy(writer, data)
bufw := bufio.NewWriterSize(writer, 32*1024)
_, err = io.Copy(bufw, data)
if err != nil {
return err
}
return bufw.Flush()
}
// Get begins downloading a Piece from a piece store Server
func (client *Client) Get(ctx context.Context, id PieceID, size int64) (ranger.RangeCloser, error) {