Skip to content

Commit

Permalink
Merge pull request #217 from stephenplaza/master
Browse files Browse the repository at this point in the history
uses accelerated gbucket GET interface in labelblk
  • Loading branch information
DocSavage authored Apr 5, 2017
2 parents 5bd2e4b + 33701ea commit 5f8dd83
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions datatype/labelblk/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,34 @@ func (d *Data) GetLabels(v dvid.VersionID, vox *Labels, r *imageblk.ROI) error {
chunkOp = &storage.ChunkOp{&getOperation{vox, nil, mapping}, wg}
}

// Send the entire range of key-value pairs to chunk processor
err = okv.ProcessRange(ctx, begTKey, endTKey, chunkOp, storage.ChunkFunc(d.ReadChunk))
if err != nil {
return fmt.Errorf("Unable to GET data %s: %v", ctx, err)
if !hasbuffer {
// Send the entire range of key-value pairs to chunk processor
err = okv.ProcessRange(ctx, begTKey, endTKey, chunkOp, storage.ChunkFunc(d.ReadChunk))
if err != nil {
return fmt.Errorf("Unable to GET data %s: %v", ctx, err)
}
} else {
// Extract block list
tkeys := make([]storage.TKey, 0)

ptBeg := indexBeg.Duplicate().(dvid.ChunkIndexer)
ptEnd := indexEnd.Duplicate().(dvid.ChunkIndexer)
begX := ptBeg.Value(0)
endX := ptEnd.Value(0)

c := dvid.ChunkPoint3d{begX, ptBeg.Value(1), ptBeg.Value(2)}
for x := begX; x <= endX; x++ {
c[0] = x
curIndex := dvid.IndexZYX(c)
currTKey := NewTKey(&curIndex)
tkeys = append(tkeys, currTKey)
}

err = okv.(storage.RequestBuffer).ProcessList(ctx, tkeys, chunkOp, storage.ChunkFunc(d.ReadChunk))
if err != nil {
return fmt.Errorf("Unable to GET data %s: %v", ctx, err)
}

}
}

Expand Down

0 comments on commit 5f8dd83

Please sign in to comment.