示例#1
0
文件: unit.go 项目: jkary/core
// Service returns the service.
func (u *Unit) Service() (*Service, error) {
	serviceTag := names.ServiceTag(u.ServiceName())
	service := &Service{
		st:  u.st,
		tag: serviceTag,
	}
	// Call Refresh() immediately to get the up-to-date
	// life and other needed locally cached fields.
	err := service.Refresh()
	if err != nil {
		return nil, err
	}
	return service, nil
}
示例#2
0
文件: service.go 项目: jkary/core
// Tag returns a name identifying the service that is safe to use
// as a file name.  The returned name will be different from other
// Tag values returned by any other entities from the same state.
func (s *Service) Tag() string {
	return names.ServiceTag(s.Name())
}
示例#3
0
文件: unit.go 项目: jkary/core
// ServiceTag returns the service tag.
func (u *Unit) ServiceTag() string {
	return names.ServiceTag(u.ServiceName())
}