mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
Make blockSize as constant
This commit is contained in:
parent
a8c8e4d335
commit
b495f15178
@ -19,13 +19,14 @@ package encoded
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/minio-io/minio/pkg/donutbox"
|
"github.com/minio-io/minio/pkg/donutbox"
|
||||||
"github.com/minio-io/minio/pkg/encoding/erasure"
|
"github.com/minio-io/minio/pkg/encoding/erasure"
|
||||||
"github.com/minio-io/minio/pkg/storage"
|
"github.com/minio-io/minio/pkg/storage"
|
||||||
"github.com/minio-io/minio/pkg/utils/split"
|
"github.com/minio-io/minio/pkg/utils/split"
|
||||||
"io"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// StorageDriver creates a new single disk storage driver using donut without encoding.
|
// StorageDriver creates a new single disk storage driver using donut without encoding.
|
||||||
@ -33,6 +34,10 @@ type StorageDriver struct {
|
|||||||
donutBox donutbox.DonutBox
|
donutBox donutbox.DonutBox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
blockSize = 10 * 1024 * 1024
|
||||||
|
)
|
||||||
|
|
||||||
// Start a single disk subsystem
|
// Start a single disk subsystem
|
||||||
func Start(donutBox donutbox.DonutBox) (chan<- string, <-chan error, storage.Storage) {
|
func Start(donutBox donutbox.DonutBox) (chan<- string, <-chan error, storage.Storage) {
|
||||||
ctrlChannel := make(chan string)
|
ctrlChannel := make(chan string)
|
||||||
@ -79,7 +84,7 @@ func (diskStorage StorageDriver) GetObject(target io.Writer, bucket, key string)
|
|||||||
return 0, errors.New("Cannot parse erasureM")
|
return 0, errors.New("Cannot parse erasureM")
|
||||||
}
|
}
|
||||||
columnCount := k + m
|
columnCount := k + m
|
||||||
blockSize, err := strconv.Atoi(metadata["blockSize"])
|
bs, err := strconv.Atoi(metadata["blockSize"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errors.New("Cannot parse blockSize")
|
return 0, errors.New("Cannot parse blockSize")
|
||||||
}
|
}
|
||||||
@ -87,7 +92,7 @@ func (diskStorage StorageDriver) GetObject(target io.Writer, bucket, key string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errors.New("Cannot parse length")
|
return 0, errors.New("Cannot parse length")
|
||||||
}
|
}
|
||||||
chunkCount := size/blockSize + 1
|
chunkCount := size/bs + 1
|
||||||
var readers []io.Reader
|
var readers []io.Reader
|
||||||
for column := 0; column < columnCount; column++ {
|
for column := 0; column < columnCount; column++ {
|
||||||
reader, err := diskStorage.donutBox.GetObjectReader(bucket, key, uint(column))
|
reader, err := diskStorage.donutBox.GetObjectReader(bucket, key, uint(column))
|
||||||
@ -164,7 +169,6 @@ func (diskStorage StorageDriver) ListObjects(bucket string, resources storage.Bu
|
|||||||
|
|
||||||
// CreateObject creates a new object
|
// CreateObject creates a new object
|
||||||
func (diskStorage StorageDriver) CreateObject(bucketKey string, objectKey string, contentType string, reader io.Reader) error {
|
func (diskStorage StorageDriver) CreateObject(bucketKey string, objectKey string, contentType string, reader io.Reader) error {
|
||||||
blockSize := 10 * 1024 * 1024
|
|
||||||
// split stream
|
// split stream
|
||||||
splitStream := split.Stream(reader, uint64(blockSize))
|
splitStream := split.Stream(reader, uint64(blockSize))
|
||||||
writers := make([]*donutbox.NewObject, 16)
|
writers := make([]*donutbox.NewObject, 16)
|
||||||
|
Loading…
Reference in New Issue
Block a user