本文整理匯總了Golang中github.com/juju/juju/service.DiscoverService函數的典型用法代碼示例。如果您正苦於以下問題:Golang DiscoverService函數的具體用法?Golang DiscoverService怎麽用?Golang DiscoverService使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DiscoverService函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewSimpleContext
// NewSimpleContext returns a new SimpleContext, acting on behalf of
// the specified deployer, that deploys unit agents.
// Paths to which agents and tools are installed are relative to dataDir.
func NewSimpleContext(agentConfig agent.Config, api APICalls) *SimpleContext {
return &SimpleContext{
api: api,
agentConfig: agentConfig,
discoverService: func(name string, conf common.Conf) (deployerService, error) {
return service.DiscoverService(name, conf)
},
listServices: func() ([]string, error) {
return service.ListServices()
},
}
}
示例2: TestDiscoverServiceVersionFallback
func (s *discoverySuite) TestDiscoverServiceVersionFallback(c *gc.C) {
for _, test := range discoveryTests {
test.log(c)
test.disableLocalDiscovery(c, s)
test.setVersion(s)
svc, err := service.DiscoverService(s.name, s.conf)
test.checkService(c, svc, err, s.name, s.conf)
}
}
示例3: TestDiscoverServiceLocalHost
func (s *discoverySuite) TestDiscoverServiceLocalHost(c *gc.C) {
var localInitSystem string
var err error
switch runtime.GOOS {
case "windows":
localInitSystem = service.InitSystemWindows
case "linux":
localInitSystem, err = service.VersionInitSystem(series.HostSeries())
}
c.Assert(err, gc.IsNil)
test := discoveryTest{
os: jujuos.HostOS(),
series: series.HostSeries(),
expected: localInitSystem,
}
test.disableVersionDiscovery(s)
svc, err := service.DiscoverService(s.name, s.conf)
c.Assert(err, jc.ErrorIsNil)
test.checkService(c, svc, err, s.name, s.conf)
}
示例4: OpenPorts
return err
}
return nil
}
type agentService interface {
Stop() error
Remove() error
}
var mongoRemoveService = func(namespace string) error {
return mongo.RemoveService(namespace)
}
var discoverService = func(name string) (agentService, error) {
return service.DiscoverService(name, servicecommon.Conf{})
}
// OpenPorts is specified in the Environ interface.
func (env *localEnviron) OpenPorts(ports []network.PortRange) error {
return fmt.Errorf("open ports not implemented")
}
// ClosePorts is specified in the Environ interface.
func (env *localEnviron) ClosePorts(ports []network.PortRange) error {
return fmt.Errorf("close ports not implemented")
}
// Ports is specified in the Environ interface.
func (env *localEnviron) Ports() ([]network.PortRange, error) {
return nil, nil