本文整理汇总了Golang中github.com/youtube/vitess/go/rpcplus.Client类的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: getSrvKeyspace
func getSrvKeyspace(rpcClient *rpcplus.Client, cell, keyspace string, verbose bool) {
req := &topo.GetSrvKeyspaceArgs{
Cell: cell,
Keyspace: keyspace,
}
reply := &topo.SrvKeyspace{}
if err := rpcClient.Call("TopoReader.GetSrvKeyspace", req, reply); err != nil {
log.Fatalf("TopoReader.GetSrvKeyspace error: %v", err)
}
if verbose {
tabletTypes := make([]string, 0, len(reply.Partitions))
for t, _ := range reply.Partitions {
tabletTypes = append(tabletTypes, string(t))
}
sort.Strings(tabletTypes)
for _, t := range tabletTypes {
println(fmt.Sprintf("Partitions[%v] =", t))
for i, s := range reply.Partitions[topo.TabletType(t)].Shards {
println(fmt.Sprintf(" Shards[%v]=%v", i, s.KeyRange.String()))
}
}
for i, s := range reply.Shards {
println(fmt.Sprintf("Shards[%v]=%v", i, s.KeyRange.String()))
}
for i, t := range reply.TabletTypes {
println(fmt.Sprintf("TabletTypes[%v] = %v", i, t))
}
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:29,代码来源:zkclient2.go
示例2: get
func get(rpcClient *rpcplus.Client, path string, verbose bool) {
// it's a get
zkPath := &zk.ZkPath{Path: path}
zkNode := &zk.ZkNode{}
if err := rpcClient.Call("ZkReader.Get", zkPath, zkNode); err != nil {
log.Fatalf("ZkReader.Get error: %v", err)
}
if verbose {
println(fmt.Sprintf("%v = %v (NumChildren=%v, Version=%v, Cached=%v, Stale=%v)", zkNode.Path, zkNode.Data, zkNode.Stat.NumChildren(), zkNode.Stat.Version(), zkNode.Cached, zkNode.Stale))
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:12,代码来源:zkclient2.go
示例3: getSrvKeyspaceNames
func getSrvKeyspaceNames(rpcClient *rpcplus.Client, cell string, verbose bool) {
req := &topo.GetSrvKeyspaceNamesArgs{
Cell: cell,
}
reply := &topo.SrvKeyspaceNames{}
if err := rpcClient.Call("TopoReader.GetSrvKeyspaceNames", req, reply); err != nil {
log.Fatalf("TopoReader.GetSrvKeyspaceNames error: %v", err)
}
if verbose {
for i, entry := range reply.Entries {
println(fmt.Sprintf("KeyspaceNames[%v] = %v", i, entry))
}
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:14,代码来源:zkclient2.go
示例4: getv
func getv(rpcClient *rpcplus.Client, paths []string, verbose bool) {
zkPathV := &zk.ZkPathV{Paths: make([]string, len(paths))}
for i, v := range paths {
zkPathV.Paths[i] = v
}
zkNodeV := &zk.ZkNodeV{}
if err := rpcClient.Call("ZkReader.GetV", zkPathV, zkNodeV); err != nil {
log.Fatalf("ZkReader.GetV error: %v", err)
}
if verbose {
for i, zkNode := range zkNodeV.Nodes {
println(fmt.Sprintf("[%v] %v = %v (NumChildren=%v, Version=%v, Cached=%v, Stale=%v)", i, zkNode.Path, zkNode.Data, zkNode.Stat.NumChildren(), zkNode.Stat.Version(), zkNode.Cached, zkNode.Stale))
}
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:15,代码来源:zkclient2.go
示例5: getEndPoints
func getEndPoints(rpcClient *rpcplus.Client, cell, keyspace, shard, tabletType string, verbose bool) {
req := &topo.GetEndPointsArgs{
Cell: cell,
Keyspace: keyspace,
Shard: shard,
TabletType: topo.TabletType(tabletType),
}
reply := &topo.EndPoints{}
if err := rpcClient.Call("TopoReader.GetEndPoints", req, reply); err != nil {
log.Fatalf("TopoReader.GetEndPoints error: %v", err)
}
if verbose {
for i, e := range reply.Entries {
println(fmt.Sprintf("Entries[%v] = %v %v", i, e.Uid, e.Host))
}
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:17,代码来源:zkclient2.go
示例6: children
func children(rpcClient *rpcplus.Client, paths []string, verbose bool) {
for _, v := range paths {
zkPath := &zk.ZkPath{Path: v}
zkNode := &zk.ZkNode{}
if err := rpcClient.Call("ZkReader.Children", zkPath, zkNode); err != nil {
log.Fatalf("ZkReader.Children error: %v", err)
}
if verbose {
println(fmt.Sprintf("Path = %v", zkNode.Path))
for i, child := range zkNode.Children {
println(fmt.Sprintf("Child[%v] = %v", i, child))
}
println(fmt.Sprintf("NumChildren = %v", zkNode.Stat.NumChildren()))
println(fmt.Sprintf("CVersion = %v", zkNode.Stat.CVersion()))
println(fmt.Sprintf("Cached = %v", zkNode.Cached))
println(fmt.Sprintf("Stale = %v", zkNode.Stale))
}
}
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:19,代码来源:zkclient2.go
注:本文中的github.com/youtube/vitess/go/rpcplus.Client类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论