Last active
October 23, 2015 15:53
-
-
Save DocSavage/6158a39dc2e1db76baa1 to your computer and use it in GitHub Desktop.
BigTable GetRange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tbl := client.Open("mytable") | |
... | |
unvKeyBeg, _, _ := ctx.UnversionedKey(tkBeg) | |
unvKeyEnd, _, _ := ctx.UnversionedKey(tkEnd) | |
rr := bigtable.NewRange(unvKeyBeg, unvKeyEnd) | |
err := tbl.ReadRows(bt_ctx, rr, func(r Row) bool { | |
// get all versions from this row and package into "versions" which is []*storage.KeyValue | |
... | |
// run it through our DAG to get the proper value given our version context. | |
// See the code: https://github.com/janelia-flyem/dvid/blob/master/datastore/datainstance.go#L71 | |
kv, err := ctx.VersionedKeyValue(versions) | |
return true // keep going | |
}, bigtable.RowFilter(bigtable.FamilyFilter("versions"))) // No filter necessary if we only have one column family | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We could potentially refine
ctx.VersionedKeyValue(versions)
to accept a slice of struct that contains a versionID and value. If the column qualifiers are versionIDs, we don't need to decompose the full keys to get the versionID out.