Created
March 19, 2015 20:34
-
-
Save tmlbl/d3457ebc52063b52b47a to your computer and use it in GitHub Desktop.
Trying to use cockroachdb
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
"github.com/cockroachdb/cockroach/client" | |
"github.com/cockroachdb/cockroach/proto" | |
) | |
type Clock struct{} | |
func (c *Clock) Now() int64 { | |
return int64(time.Now().Nanosecond()) | |
} | |
func main() { | |
tr := &http.Transport{ | |
// TLSClientConfig: &tls.Config{RootCAs: pool}, | |
DisableCompression: true, | |
} | |
kv := client.NewKV(client.NewHTTPSender("localhost:8080", tr), &Clock{}) | |
getResp := &proto.GetResponse{} | |
err := kv.Call(proto.Get, proto.GetArgs(proto.Key("somekey")), getResp) | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println("Get response:", getResp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment