Adding chunking by block to erasure-demo via --block-size parameter

This commit is contained in:
Frederick F. Kautz IV
2014-12-01 21:06:36 -08:00
parent 59c1197f47
commit 46b08681a4
3 changed files with 108 additions and 39 deletions
+23 -5
View File
@@ -7,6 +7,7 @@ import (
"strings"
"github.com/codegangsta/cli"
"github.com/minio-io/minio/pkgs/strbyteconv"
)
func main() {
@@ -29,6 +30,11 @@ func main() {
Value: "10,6",
Usage: "data,parity",
},
cli.StringFlag{
Name: "block-size",
Value: "1M",
Usage: "Size of blocks. Examples: 1K, 1M, full",
},
},
},
{
@@ -58,7 +64,7 @@ type inputConfig struct {
output string
k int
m int
blockSize int
blockSize uint64
}
// parses input and returns an inputConfig with parsed input
@@ -88,10 +94,22 @@ func parseInput(c *cli.Context) (inputConfig, error) {
return inputConfig{}, err
}
var blockSize uint64
blockSize = 0
if c.String("block-size") != "" {
if c.String("block-size") != "full" {
blockSize, err = strbyteconv.StringToBytes(c.String("block-size"))
if err != nil {
return inputConfig{}, err
}
}
}
return inputConfig{
input: inputFilePath,
output: outputFilePath,
k: k,
m: m,
input: inputFilePath,
output: outputFilePath,
k: k,
m: m,
blockSize: blockSize,
}, nil
}