Permalink
Browse files

Update for couchbase.GetBulk API change

  • Loading branch information...
1 parent cf81bd3 commit 0ad7c0f7b29184bdd42aa88fefd3ff5edfd550b3 @dustin dustin committed Sep 26, 2013
Showing with 29 additions and 6 deletions.
  1. +9 −2 blobs.go
  2. +7 −1 fsck.go
  3. +4 −1 list.go
  4. +5 −1 nodes.go
  5. +4 −1 tasks.go
View
@@ -49,7 +49,10 @@ func (b BlobOwnership) ResolveNodes() NodeList {
for k := range b.Nodes {
keys = append(keys, "/"+k)
}
- resps := couchbase.GetBulk(keys)
+ resps, err := couchbase.GetBulk(keys)
+ if err != nil {
+ log.Panicf("Error getting nodelist: %v", err)
+ }
rv := make(NodeList, 0, len(resps))
@@ -102,7 +105,11 @@ func getBlobs(oids []string) (map[string]BlobOwnership, error) {
}
res := map[string]BlobOwnership{}
- for k, v := range couchbase.GetBulk(keys) {
+ bres, err := couchbase.GetBulk(keys)
+ if err != nil {
+ return nil, err
+ }
+ for k, v := range bres {
if v.Status == gomemcached.SUCCESS {
bo := BlobOwnership{}
err := json.Unmarshal(v.Body, &bo)
View
@@ -87,7 +87,13 @@ func dofsck(w http.ResponseWriter, req *http.Request,
fnmap[nf.meta.OID] = a
}
- for k, v := range couchbase.GetBulk(keys) {
+ bres, err := couchbase.GetBulk(keys)
+ if err != nil {
+ log.Printf("Error getting bulk keys: %v", err)
+ return
+ }
+
+ for k, v := range bres {
names := fnmap[k[1:]]
for _, name := range names {
delete(unprocessed, name)
View
@@ -61,7 +61,10 @@ func listFiles(path string, includeMeta bool,
}
// do a multi-get on the all the keys returned
- bulkResult := couchbase.GetBulk(keys)
+ bulkResult, err := couchbase.GetBulk(keys)
+ if err != nil {
+ return fileListing{}, err
+ }
// divide items up into files and directories
files := map[string]interface{}{}
View
@@ -241,7 +241,11 @@ func findAllNodes() (NodeList, error) {
rv := make(NodeList, 0, len(nodeSizes))
- for nid, mcresp := range couchbase.GetBulk(nodeKeys) {
+ bres, err := couchbase.GetBulk(nodeKeys)
+ if err != nil {
+ return nil, err
+ }
+ for nid, mcresp := range bres {
if mcresp.Status != gomemcached.SUCCESS {
log.Printf("Error fetching %v: %v", nid, mcresp)
continue
View
@@ -180,7 +180,10 @@ func listRunningTasks() (map[string]TaskList, error) {
keys = append(keys, "/@"+n.name+"/tasks")
}
- responses := couchbase.GetBulk(keys)
+ responses, err := couchbase.GetBulk(keys)
+ if responses != nil {
+ return nil, err
+ }
for k, res := range responses {
if res.Status == gomemcached.SUCCESS {

0 comments on commit 0ad7c0f

Please sign in to comment.