本文整理汇总了Golang中github.com/youtube/vitess/go/vt/servenv.Register函数的典型用法代码示例。如果您正苦于以下问题:Golang Register函数的具体用法?Golang Register怎么用?Golang Register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Register函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
// zkocc: a proxy for zk
func main() {
flag.Parse()
servenv.Init()
zkr := zkocc.NewZkReader(*resolveLocal, flag.Args())
zk.RegisterZkReader(zkr)
servenv.Register("toporeader", &TopoReader{zkr: zkr})
servenv.RunDefault()
}
示例2: main
func main() {
defer exit.Recover()
flag.Parse()
servenv.Init()
ts := topo.GetServer()
defer topo.CloseServers()
var schema *planbuilder.Schema
if *schemaFile != "" {
var err error
if schema, err = planbuilder.LoadFile(*schemaFile); err != nil {
log.Error(err)
exit.Return(1)
}
log.Infof("v3 is enabled: loaded schema from file: %v", *schemaFile)
} else {
schemafier, ok := ts.(topo.Schemafier)
if !ok {
log.Infof("Skipping v3 initialization: topo does not suppurt schemafier interface")
goto startServer
}
ctx := context.Background()
schemaJSON, err := schemafier.GetVSchema(ctx)
if err != nil {
log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
goto startServer
}
schema, err = planbuilder.NewSchema([]byte(schemaJSON))
if err != nil {
log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
goto startServer
}
log.Infof("v3 is enabled: loaded schema from topo")
}
startServer:
resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")
// For the initial phase vtgate is exposing
// topoReader api. This will be subsumed by
// vtgate once vtgate's client functions become active.
topoReader = NewTopoReader(resilientSrvTopoServer)
servenv.Register("toporeader", topoReader)
vtgate.Init(resilientSrvTopoServer, schema, *cell, *retryDelay, *retryCount, *connTimeoutTotal, *connTimeoutPerConn, *connLife, *maxInFlight)
servenv.RunDefault()
}
示例3: main
func main() {
flag.Parse()
servenv.Init()
ts := topo.GetServer()
defer topo.CloseServers()
resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")
// For the initial phase vtgate is exposing
// topoReader api. This will be subsumed by
// vtgate once vtgate's client functions become active.
topoReader = NewTopoReader(resilientSrvTopoServer)
servenv.Register("toporeader", topoReader)
vtgate.Init(resilientSrvTopoServer, *cell, *retryDelay, *retryCount, *timeout, *maxInFlight)
servenv.RunDefault()
}
示例4: main
func main() {
flag.Parse()
servenv.Init()
ts := topo.GetServer()
defer topo.CloseServers()
resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")
labels := []string{"Cell", "Keyspace", "ShardName", "DbType"}
_ = stats.NewMultiCountersFunc("EndpointCount", labels, resilientSrvTopoServer.EndpointCount)
_ = stats.NewMultiCountersFunc("DegradedEndpointCount", labels, resilientSrvTopoServer.DegradedEndpointCount)
// For the initial phase vtgate is exposing
// topoReader api. This will be subsumed by
// vtgate once vtgate's client functions become active.
topoReader = NewTopoReader(resilientSrvTopoServer)
servenv.Register("toporeader", topoReader)
vtgate.Init(resilientSrvTopoServer, *cell, *retryDelay, *retryCount, *timeout, *maxInFlight)
servenv.RunDefault()
}
示例5: init
func init() {
vtgate.RegisterVTGates = append(vtgate.RegisterVTGates, func(vtGate vtgateservice.VTGateService) {
servenv.Register("vtgateservice", New(vtGate))
})
}
示例6: StartServer
// StartServer registers the Server for RPCs.
func StartServer(mysqld *mysqlctl.Mysqld) {
servenv.Register("mysqlctl", &MysqlctlServer{mysqld})
}
示例7: init
func init() {
binlog.RegisterUpdateStreamServices = append(binlog.RegisterUpdateStreamServices, func(updateStream proto.UpdateStream) {
servenv.Register("updatestream", New(updateStream))
})
}
示例8: init
func init() {
tabletmanager.RegisterQueryServices = append(tabletmanager.RegisterQueryServices, func(agent *tabletmanager.ActionAgent) {
servenv.Register("tabletmanager", &TabletManager{agent})
})
}
示例9: init
func init() {
tabletserver.RegisterFunctions = append(tabletserver.RegisterFunctions, func(qsc tabletserver.Controller) {
servenv.Register("queryservice", New(qsc.QueryService()))
})
}
示例10: StartServer
// StartServer registers the Server for RPCs
func StartServer(ts topo.Server) {
servenv.Register("vtctl", NewVtctlServer(ts))
}
示例11: init
func init() {
tabletserver.SqlQueryRegisterFunctions = append(tabletserver.SqlQueryRegisterFunctions, func(sq *tabletserver.SqlQuery) {
servenv.Register("queryservice", &SqlQuery{sq})
})
}
示例12: init
func init() {
binlog.RegisterUpdateStreamServices = append(binlog.RegisterUpdateStreamServices, func(updateStream *binlog.UpdateStream) {
servenv.Register("updatestream", &UpdateStream{updateStream})
})
}
示例13: StartServer
// StartServer registers the Server for RPCs
func StartServer(ts topo.Server) {
servenv.Register("vtctl", &VtctlServer{ts})
}
示例14: init
func init() {
vtgate.RegisterVTGates = append(vtgate.RegisterVTGates, func(vtGate *vtgate.VTGate) {
servenv.Register("vtgateservice", &VTGate{vtGate})
})
}