From eff48971ad2341c136657b95ffd44fe5fe36c781 Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Wed, 25 Mar 2015 17:05:23 -0700 Subject: [PATCH] Adding iodine to donut bucket --- pkg/storage/donut/bucket.go | 9 +++++---- pkg/storage/donut/interfaces.go | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/storage/donut/bucket.go b/pkg/storage/donut/bucket.go index 31ff7f11a..9e027d98d 100644 --- a/pkg/storage/donut/bucket.go +++ b/pkg/storage/donut/bucket.go @@ -2,6 +2,7 @@ package donut import ( "errors" + "github.com/minio-io/iodine" "strconv" "strings" ) @@ -12,7 +13,7 @@ type donutBucket struct { } // GetNodes - get list of associated nodes for a given bucket -func (b donutBucket) GetNodes() ([]string, error) { +func (b donutBucket) GetNodes() ([]string, *iodine.Error) { var nodes []string for _, node := range b.nodes { nodes = append(nodes, node) @@ -20,17 +21,17 @@ func (b donutBucket) GetNodes() ([]string, error) { return nodes, nil } -func (b donutBucket) AddNode(nodeID, bucketID string) error { +func (b donutBucket) AddNode(nodeID, bucketID string) *iodine.Error { tokens := strings.Split(bucketID, ":") if len(tokens) != 3 { - return errors.New("Bucket ID malformed: " + bucketID) + return iodine.New(errors.New("Bucket ID malformed: "+bucketID), map[string]string{"nodeID": nodeID, "bucketID": bucketID}) } // bucketName := tokens[0] // aggregate := tokens[1] // aggregate := "0" part, err := strconv.Atoi(tokens[2]) if err != nil { - return errors.New("Part malformed: " + tokens[2]) + return iodine.New(errors.New("Part malformed: "+tokens[2]), map[string]string{"nodeID": nodeID, "bucketID": bucketID}) } b.nodes[part] = nodeID return nil diff --git a/pkg/storage/donut/interfaces.go b/pkg/storage/donut/interfaces.go index dcd822e45..658f0e3ce 100644 --- a/pkg/storage/donut/interfaces.go +++ b/pkg/storage/donut/interfaces.go @@ -1,6 +1,7 @@ package donut import ( + "github.com/minio-io/iodine" "io" ) @@ -18,8 +19,8 @@ type Donut interface { // Bucket interface type Bucket interface { - GetNodes() ([]string, error) - AddNode(nodeID, bucketID string) error + GetNodes() ([]string, *iodine.Error) + AddNode(nodeID, bucketID string) *iodine.Error } // Node interface