func testGOBClient(t *testing.T, dhashes []*Node) { fmt.Println(" === Run testGOBClient") clearAll(dhashes) c := client.MustConn(dhashes[0].GetBroadcastAddr()) c.Start() testClientInterface(t, dhashes, c) }
func BenchmarkClientAndServer(b *testing.B) { oldprocs := runtime.GOMAXPROCS(runtime.NumCPU()) defer runtime.GOMAXPROCS(oldprocs) b.StopTimer() if benchNode == nil { benchNode = NewNode("127.0.0.1:1231", "127.0.0.1:1231") benchNode.MustStart() } c := client.MustConn("127.0.0.1:1231") c.Clear() var bs [][]byte for i := 0; i < b.N; i++ { bs = append(bs, murmur.HashString(fmt.Sprint(i))) } b.StartTimer() for i := 0; i < b.N; i++ { c.Put(bs[i], bs[i]) } }
func main() { flag.Parse() conn := client.MustConn(fmt.Sprintf("%v:%v", *ip, *port)) if len(flag.Args()) == 0 { show(conn) } else { for spec, fun := range actions { if spec.cmd == flag.Args()[0] { matchingParts := true for index, reg := range spec.args { if !reg.MatchString(flag.Args()[index+1]) { matchingParts = false break } } if matchingParts { fun(conn, flag.Args()) return } } } fmt.Println("No command given?") } }