• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang registry.GetRegistry函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/vulcand/vulcand/plugin/registry.GetRegistry函数的典型用法代码示例。如果您正苦于以下问题:Golang GetRegistry函数的具体用法?Golang GetRegistry怎么用?Golang GetRegistry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetRegistry函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: SetUpTest

func (s *ApiSuite) SetUpTest(c *C) {
	newProxy := func(id int) (proxy.Proxy, error) {
		return proxy.New(id, stapler.New(), proxy.Options{})
	}

	s.ng = memng.New(registry.GetRegistry())

	sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{})

	app := scroll.NewApp()
	InitProxyController(s.ng, sv, app)
	s.testServer = httptest.NewServer(app.GetHandler())
	s.client = NewClient(s.testServer.URL, registry.GetRegistry())
}
开发者ID:huhoo,项目名称:vulcand,代码行数:14,代码来源:api_test.go


示例2: main

func main() {
	cmd := command.NewCommand(registry.GetRegistry())
	err := cmd.Run(os.Args)
	if err != nil {
		cmd.PrintError(err)
	}
}
开发者ID:vulcand,项目名称:vulcand,代码行数:7,代码来源:main.go


示例3: main

func main() {
	cmd := command.NewCommand(registry.GetRegistry())
	err := cmd.Run(os.Args)
	if err != nil {
		log.Errorf("error: %s\n", err)
	}
}
开发者ID:octoblu,项目名称:vulcand-bundle,代码行数:7,代码来源:main.go


示例4: SetUpTest

func (s *MemSuite) SetUpTest(c *C) {
	engine := New(registry.GetRegistry())

	s.suite.ChangesC = make(chan interface{})
	s.stopC = make(chan bool)
	go engine.Subscribe(s.suite.ChangesC, 0, s.stopC)
	s.suite.Engine = engine
}
开发者ID:vulcand,项目名称:vulcand,代码行数:8,代码来源:mem_test.go


示例5: run

func (s *CmdSuite) run(params ...string) string {
	args := []string{"vctl"}
	args = append(args, params...)
	args = append(args, fmt.Sprintf("--vulcan=%s", s.testServer.URL))
	s.out = &bytes.Buffer{}
	s.cmd = &Command{registry: registry.GetRegistry(), out: s.out, vulcanUrl: s.testServer.URL}
	s.cmd.Run(args)
	return strings.Replace(s.out.String(), "\n", " ", -1)
}
开发者ID:huhoo,项目名称:vulcand,代码行数:9,代码来源:command_test.go


示例6: SetUpTest

func (s *CmdSuite) SetUpTest(c *C) {
	s.ng = memng.New(registry.GetRegistry())

	newProxy := func(id int) (proxy.Proxy, error) {
		return proxy.New(id, stapler.New(), proxy.Options{})
	}

	sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{})
	sv.Start()
	s.sv = sv

	app := scroll.NewApp()
	api.InitProxyController(s.ng, sv, app)
	s.testServer = httptest.NewServer(app.GetHandler())

	s.out = &bytes.Buffer{}
	s.cmd = &Command{registry: registry.GetRegistry(), out: s.out, vulcanUrl: s.testServer.URL}
}
开发者ID:huhoo,项目名称:vulcand,代码行数:18,代码来源:command_test.go


示例7: main

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	if err := service.Run(registry.GetRegistry()); err != nil {
		fmt.Printf("Service exited with error: %s\n", err)
		os.Exit(255)
	} else {
		fmt.Println("Service exited gracefully")
	}
}
开发者ID:huhoo,项目名称:vulcand,代码行数:9,代码来源:main.go


示例8: SetUpTest

func (s *SupervisorSuite) SetUpTest(c *C) {
	s.ng = memng.New(registry.GetRegistry()).(*memng.Mem)

	s.errorC = make(chan error)

	s.clock = &timetools.FreezedTime{
		CurrentTime: time.Date(2012, 3, 4, 5, 6, 7, 0, time.UTC),
	}

	s.sv = New(newProxy, s.ng, s.errorC, Options{Clock: s.clock})
}
开发者ID:huhoo,项目名称:vulcand,代码行数:11,代码来源:supervisor_test.go


示例9: NewRegistry

func NewRegistry(
	addr, backendID, serverID, ipAddress string, port uint,
	ttl time.Duration) *Registry {
	return &Registry{
		api.NewClient(addr, registry.GetRegistry()),
		backendID,
		serverID,
		fmt.Sprintf("http://%s:%d", ipAddress, port),
		ttl,
	}
}
开发者ID:upfluence,项目名称:vulcand-healthcheck,代码行数:11,代码来源:registry.go


示例10: SetUpTest

func (s *S) SetUpTest(c *check.C) {
	var err error
	s.conn, err = db.Conn()
	c.Assert(err, check.IsNil)
	dbtest.ClearAllCollections(s.conn.Collection("router_vulcand_tests").Database)
	s.engine = memng.New(registry.GetRegistry())
	scrollApp := scroll.NewApp()
	api.InitProxyController(s.engine, &supervisor.Supervisor{}, scrollApp)
	s.vulcandServer = httptest.NewServer(scrollApp.GetHandler())
	config.Set("routers:vulcand:api-url", s.vulcandServer.URL)
}
开发者ID:tsuru,项目名称:tsuru,代码行数:11,代码来源:router_test.go


示例11: SetUpTest

func (s *EtcdSuite) SetUpTest(c *C) {
	// Initiate a backend with a registry

	key, err := secret.KeyFromString(s.key)
	c.Assert(err, IsNil)

	box, err := secret.NewBox(key)
	c.Assert(err, IsNil)

	engine, err := New(
		s.nodes,
		s.etcdPrefix,
		registry.GetRegistry(),
		Options{
			EtcdConsistency: s.consistency,
			Box:             box,
		})
	c.Assert(err, IsNil)
	s.ng = engine.(*ng)
	s.client = s.ng.client
	s.context = context.Background()

	// Delete all values under the given prefix
	_, err = s.client.Get(s.context, s.etcdPrefix)
	if err != nil {
		// There's no key like this
		if !notFound(err) {
			// We haven't expected this error, oops
			c.Assert(err, IsNil)
		}
	} else {
		_, err = s.ng.client.Delete(s.context, s.etcdPrefix, etcd.WithPrefix())
		c.Assert(err, IsNil)
	}

	s.changesC = make(chan interface{})
	s.stopC = make(chan bool)

	//find current index, so we only watch from now onwards
	response, err := s.ng.client.Get(s.ng.context, "/")
	c.Assert(response, NotNil)
	c.Assert(err, IsNil)

	go s.ng.Subscribe(s.changesC, uint64(response.Header.Revision+1), s.stopC)

	s.suite.ChangesC = s.changesC
	s.suite.Engine = engine
}
开发者ID:vulcand,项目名称:vulcand,代码行数:48,代码来源:etcd_test.go


示例12: createRouter

func createRouter(routerName, configPrefix string) (router.Router, error) {
	vURL, err := config.GetString(configPrefix + ":api-url")
	if err != nil {
		return nil, err
	}
	domain, err := config.GetString(configPrefix + ":domain")
	if err != nil {
		return nil, err
	}
	client := api.NewClient(vURL, registry.GetRegistry())
	vRouter := &vulcandRouter{
		client: client,
		prefix: configPrefix,
		domain: domain,
	}
	return vRouter, nil
}
开发者ID:pedrosnk,项目名称:tsuru,代码行数:17,代码来源:router.go


示例13: SetUpTest

func (s *EtcdSuite) SetUpTest(c *C) {
	// Initiate a backend with a registry

	key, err := secret.KeyFromString(s.key)
	c.Assert(err, IsNil)

	box, err := secret.NewBox(key)
	c.Assert(err, IsNil)

	engine, err := New(
		s.nodes,
		s.etcdPrefix,
		registry.GetRegistry(),
		Options{
			EtcdConsistency: s.consistency,
			Box:             box,
		})
	c.Assert(err, IsNil)
	s.ng = engine.(*ng)
	s.client = s.ng.client
	s.kapi = s.ng.kapi

	// Delete all values under the given prefix
	_, err = s.kapi.Get(s.context, s.etcdPrefix, &etcd.GetOptions{Recursive: false, Sort: false})
	if err != nil {
		// There's no key like this
		if !notFound(err) {
			// We haven't expected this error, oops
			c.Assert(err, IsNil)
		}
	} else {
		_, err = s.ng.kapi.Delete(s.context, s.etcdPrefix, &etcd.DeleteOptions{Recursive: true})
		c.Assert(err, IsNil)
	}

	s.changesC = make(chan interface{})
	s.stopC = make(chan bool)
	go s.ng.Subscribe(s.changesC, s.stopC)

	s.suite.ChangesC = s.changesC
	s.suite.Engine = engine
}
开发者ID:vnadgir-ef,项目名称:vulcand,代码行数:42,代码来源:etcd_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang proxy.Proxy类代码示例发布时间:2022-05-28
下一篇:
Golang plugin.NewRegistry函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap