Merge pull request #130 from harshavardhana/pr_out_implement_add_commit_instead_of_put_encoded

master
Harshavardhana 10 years ago
commit fa52e8b355
  1. 2
      cmd/minio/add.go
  2. 22
      cmd/minio/commit.go
  3. 5
      cmd/minio/get.go
  4. 17
      cmd/minio/minio.go

@ -8,7 +8,7 @@ import (
"github.com/codegangsta/cli"
)
func put(c *cli.Context) {
func add(c *cli.Context) {
config, err := parseInput(c)
if err != nil {
log.Fatal(err)

@ -1,12 +1,29 @@
package main
import (
"io/ioutil"
"log"
"os"
"path"
"github.com/codegangsta/cli"
)
func encode(c *cli.Context) {
func cleanupStagingDir(stagingDir string) {
filelist, err := ioutil.ReadDir(stagingDir)
if err != nil {
log.Fatal(err)
}
for _, file := range filelist {
_file := path.Join(stagingDir, file.Name())
if err := os.Remove(_file); err != nil {
log.Fatal(err)
}
}
}
func commit(c *cli.Context) {
config, err := parseInput(c)
if err != nil {
log.Fatal(err)
@ -34,4 +51,7 @@ func encode(c *cli.Context) {
if err != nil {
log.Fatal(err)
}
// Cleanup stagingDir
cleanupStagingDir(config.stagingDir)
}

@ -22,7 +22,10 @@ func get(c *cli.Context) {
log.Fatal("Please specify a valid object name \n # erasure-demo get [OBJECTNAME]")
}
if objectReader, err = erasureGet(config, objectName); err != nil {
getConfig := config
getConfig.k = 10
getConfig.m = 6
if objectReader, err = erasureGet(getConfig, objectName); err != nil {
log.Fatal(err)
}

@ -12,9 +12,9 @@ func main() {
app.Usage = "minio - object storage"
app.Commands = []cli.Command{
{
Name: "encode",
Usage: "erasure encode a byte stream",
Action: encode,
Name: "commit",
Usage: "provide higher protection for uploaded object",
Action: commit,
Flags: []cli.Flag{
cli.StringFlag{
Name: "root",
@ -48,11 +48,6 @@ func main() {
Value: getObjectdir(".minio/erasure"),
Usage: "",
},
cli.StringFlag{
Name: "protection-level",
Value: "10,6",
Usage: "data,parity",
},
cli.StringFlag{
Name: "block-size",
Value: "1M",
@ -61,9 +56,9 @@ func main() {
},
},
{
Name: "put",
Usage: "put an object",
Action: put,
Name: "add",
Usage: "add an object",
Action: add,
Flags: []cli.Flag{
cli.StringFlag{
Name: "staging",

Loading…
Cancel
Save