本文整理汇总了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())
}
示例2: main
func main() {
cmd := command.NewCommand(registry.GetRegistry())
err := cmd.Run(os.Args)
if err != nil {
cmd.PrintError(err)
}
}
示例3: main
func main() {
cmd := command.NewCommand(registry.GetRegistry())
err := cmd.Run(os.Args)
if err != nil {
log.Errorf("error: %s\n", err)
}
}
示例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
}
示例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)
}
示例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}
}
示例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")
}
}
示例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})
}
示例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,
}
}
示例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)
}
示例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
}
示例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
}
示例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
}