mirror of
https://github.com/minio/minio.git
synced 2025-02-04 10:26:01 -05:00
Merge pull request #333 from fkautz/pr_out_removing_gob_from_donut_driver
This commit is contained in:
commit
7d6534088e
@ -2,6 +2,7 @@ package donut
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@ -13,9 +14,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"encoding/gob"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/minio-io/minio/pkg/encoding/erasure"
|
||||
"github.com/minio-io/minio/pkg/utils/split"
|
||||
)
|
||||
@ -127,13 +125,9 @@ func erasureReader(readers []io.ReadCloser, donutMetadata map[string]string, wri
|
||||
for i := 0; i < totalChunks; i++ {
|
||||
encodedBytes := make([][]byte, 16)
|
||||
for i, reader := range readers {
|
||||
var bytesArray []byte
|
||||
decoder := gob.NewDecoder(reader)
|
||||
err := decoder.Decode(&bytesArray)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
encodedBytes[i] = bytesArray
|
||||
var bytesBuffer bytes.Buffer
|
||||
io.Copy(&bytesBuffer, reader)
|
||||
encodedBytes[i] = bytesBuffer.Bytes()
|
||||
}
|
||||
curBlockSize := totalLeft
|
||||
if blockSize < totalLeft {
|
||||
@ -185,10 +179,7 @@ func erasureGoroutine(r *io.PipeReader, eWriter erasureWriter, isClosed chan<- b
|
||||
totalLength = totalLength + len(chunk.Data)
|
||||
encodedBlocks, _ := encoder.Encode(chunk.Data)
|
||||
for blockIndex, block := range encodedBlocks {
|
||||
var byteBuffer bytes.Buffer
|
||||
gobEncoder := gob.NewEncoder(&byteBuffer)
|
||||
gobEncoder.Encode(block)
|
||||
io.Copy(eWriter.writers[blockIndex], &byteBuffer)
|
||||
io.Copy(eWriter.writers[blockIndex], bytes.NewBuffer(block))
|
||||
}
|
||||
}
|
||||
chunkCount = chunkCount + 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user