本文整理匯總了Golang中github.com/litl/galaxy/config.Store.GetServiceRegistration方法的典型用法代碼示例。如果您正苦於以下問題:Golang Store.GetServiceRegistration方法的具體用法?Golang Store.GetServiceRegistration怎麽用?Golang Store.GetServiceRegistration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/litl/galaxy/config.Store
的用法示例。
在下文中一共展示了Store.GetServiceRegistration方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Status
func Status(serviceRuntime *runtime.ServiceRuntime, configStore *config.Store, env, pool, hostIP string) error {
containers, err := serviceRuntime.ManagedContainers()
if err != nil {
panic(err)
}
//FIXME: addresses, port, and expires missing in output
columns := []string{
"APP | CONTAINER ID | IMAGE | EXTERNAL | INTERNAL | PORT | CREATED | EXPIRES"}
for _, container := range containers {
name := serviceRuntime.EnvFor(container)["GALAXY_APP"]
registered, err := configStore.GetServiceRegistration(
env, pool, hostIP, container)
if err != nil {
return err
}
if registered != nil {
columns = append(columns,
strings.Join([]string{
registered.Name,
registered.ContainerID[0:12],
registered.Image,
registered.ExternalAddr(),
registered.InternalAddr(),
registered.Port,
utils.HumanDuration(time.Now().UTC().Sub(registered.StartedAt)) + " ago",
"In " + utils.HumanDuration(registered.Expires.Sub(time.Now().UTC())),
}, " | "))
} else {
columns = append(columns,
strings.Join([]string{
name,
container.ID[0:12],
container.Image,
"",
"",
"",
utils.HumanDuration(time.Now().Sub(container.Created)) + " ago",
"",
}, " | "))
}
}
result, _ := columnize.SimpleFormat(columns)
log.Println(result)
return nil
}