本文整理汇总了Golang中github.com/youtube/vitess/go/vt/proto/tabletmanagerservice.RegisterTabletManagerServer函数的典型用法代码示例。如果您正苦于以下问题:Golang RegisterTabletManagerServer函数的具体用法?Golang RegisterTabletManagerServer怎么用?Golang RegisterTabletManagerServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RegisterTabletManagerServer函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestGRPCTMServer
// TestGRPCTMServer creates a fake server implementation, a fake client
// implementation, and runs the test suite against the setup.
func TestGRPCTMServer(t *testing.T) {
// Listen on a random port
listener, err := net.Listen("tcp", ":0")
if err != nil {
t.Fatalf("Cannot listen: %v", err)
}
host := listener.Addr().(*net.TCPAddr).IP.String()
port := int32(listener.Addr().(*net.TCPAddr).Port)
// Create a gRPC server and listen on the port.
s := grpc.NewServer()
fakeAgent := agentrpctest.NewFakeRPCAgent(t)
tabletmanagerservicepb.RegisterTabletManagerServer(s, &server{agent: fakeAgent})
go s.Serve(listener)
// Create a gRPC client to talk to the fake tablet.
client := &grpctmclient.Client{}
ti := topo.NewTabletInfo(&topodatapb.Tablet{
Alias: &topodatapb.TabletAlias{
Cell: "test",
Uid: 123,
},
Hostname: host,
PortMap: map[string]int32{
"grpc": port,
},
}, 0)
// and run the test suite
agentrpctest.Run(t, client, ti, fakeAgent)
}
示例2: init
func init() {
tabletmanager.RegisterQueryServices = append(tabletmanager.RegisterQueryServices, func(agent *tabletmanager.ActionAgent) {
if servenv.GRPCCheckServiceMap("tabletmanager") {
tabletmanagerservicepb.RegisterTabletManagerServer(servenv.GRPCServer, &server{agent})
}
})
}
示例3: RegisterForTest
// RegisterForTest will register the RPC, to be used by test instances only
func RegisterForTest(s *grpc.Server, agent *tabletmanager.ActionAgent) {
tabletmanagerservicepb.RegisterTabletManagerServer(s, &server{agent})
}