当前位置: 首页>>代码示例>>Golang>>正文


Golang servenv.Register函数代码示例

本文整理汇总了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()
}
开发者ID:miffa,项目名称:vitess,代码行数:11,代码来源:zkocc.go

示例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()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:49,代码来源:vtgate.go

示例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()
}
开发者ID:plobsing,项目名称:vitess,代码行数:18,代码来源:vtgate.go

示例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()
}
开发者ID:miffa,项目名称:vitess,代码行数:22,代码来源:vtgate.go

示例5: init

func init() {
	vtgate.RegisterVTGates = append(vtgate.RegisterVTGates, func(vtGate vtgateservice.VTGateService) {
		servenv.Register("vtgateservice", New(vtGate))
	})
}
开发者ID:richarwu,项目名称:vitess,代码行数:5,代码来源:server.go

示例6: StartServer

// StartServer registers the Server for RPCs.
func StartServer(mysqld *mysqlctl.Mysqld) {
	servenv.Register("mysqlctl", &MysqlctlServer{mysqld})
}
开发者ID:plobsing,项目名称:vitess,代码行数:4,代码来源:server.go

示例7: init

func init() {
	binlog.RegisterUpdateStreamServices = append(binlog.RegisterUpdateStreamServices, func(updateStream proto.UpdateStream) {
		servenv.Register("updatestream", New(updateStream))
	})
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:5,代码来源:streamer.go

示例8: init

func init() {
	tabletmanager.RegisterQueryServices = append(tabletmanager.RegisterQueryServices, func(agent *tabletmanager.ActionAgent) {
		servenv.Register("tabletmanager", &TabletManager{agent})
	})
}
开发者ID:hadmagic,项目名称:vitess,代码行数:5,代码来源:gorpc_server.go

示例9: init

func init() {
	tabletserver.RegisterFunctions = append(tabletserver.RegisterFunctions, func(qsc tabletserver.Controller) {
		servenv.Register("queryservice", New(qsc.QueryService()))
	})
}
开发者ID:hadmagic,项目名称:vitess,代码行数:5,代码来源:sqlquery.go

示例10: StartServer

// StartServer registers the Server for RPCs
func StartServer(ts topo.Server) {
	servenv.Register("vtctl", NewVtctlServer(ts))
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:4,代码来源:server.go

示例11: init

func init() {
	tabletserver.SqlQueryRegisterFunctions = append(tabletserver.SqlQueryRegisterFunctions, func(sq *tabletserver.SqlQuery) {
		servenv.Register("queryservice", &SqlQuery{sq})
	})
}
开发者ID:plobsing,项目名称:vitess,代码行数:5,代码来源:sqlquery.go

示例12: init

func init() {
	binlog.RegisterUpdateStreamServices = append(binlog.RegisterUpdateStreamServices, func(updateStream *binlog.UpdateStream) {
		servenv.Register("updatestream", &UpdateStream{updateStream})
	})
}
开发者ID:miffa,项目名称:vitess,代码行数:5,代码来源:streamer.go

示例13: StartServer

// StartServer registers the Server for RPCs
func StartServer(ts topo.Server) {
	servenv.Register("vtctl", &VtctlServer{ts})
}
开发者ID:plobsing,项目名称:vitess,代码行数:4,代码来源:server.go

示例14: init

func init() {
	vtgate.RegisterVTGates = append(vtgate.RegisterVTGates, func(vtGate *vtgate.VTGate) {
		servenv.Register("vtgateservice", &VTGate{vtGate})
	})
}
开发者ID:miffa,项目名称:vitess,代码行数:5,代码来源:server.go


注:本文中的github.com/youtube/vitess/go/vt/servenv.Register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。