本文整理汇总了Golang中github.com/juju/juju/api/firewaller.Service类的典型用法代码示例。如果您正苦于以下问题:Golang Service类的具体用法?Golang Service怎么用?Golang Service使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Service类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: startService
// startService creates a new data value for tracking details of the
// service and starts watching the service for exposure changes.
func (fw *Firewaller) startService(service *firewaller.Service) error {
exposed, err := service.IsExposed()
if err != nil {
return err
}
serviced := &serviceData{
fw: fw,
service: service,
exposed: exposed,
unitds: make(map[names.UnitTag]*unitData),
}
err = catacomb.Invoke(catacomb.Plan{
Site: &serviced.catacomb,
Work: func() error {
return serviced.watchLoop(exposed)
},
})
if err != nil {
return errors.Trace(err)
}
if err := fw.catacomb.Add(serviced); err != nil {
return errors.Trace(err)
}
fw.serviceds[service.Tag()] = serviced
return nil
}
示例2: startService
// startService creates a new data value for tracking details of the
// service and starts watching the service for exposure changes.
func (fw *Firewaller) startService(service *apifirewaller.Service) error {
exposed, err := service.IsExposed()
if err != nil {
return err
}
serviced := &serviceData{
fw: fw,
service: service,
exposed: exposed,
unitds: make(map[names.UnitTag]*unitData),
}
fw.serviceds[service.Tag()] = serviced
go serviced.watchLoop(serviced.exposed)
return nil
}