本文整理匯總了Golang中github.com/NetSys/quilt/db.Database.MinionSelf方法的典型用法代碼示例。如果您正苦於以下問題:Golang Database.MinionSelf方法的具體用法?Golang Database.MinionSelf怎麽用?Golang Database.MinionSelf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/NetSys/quilt/db.Database
的用法示例。
在下文中一共展示了Database.MinionSelf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: readContainerTransact
func readContainerTransact(view db.Database, dir directory) {
minion, err := view.MinionSelf()
worker := err == nil && minion.Role == db.Worker
for _, container := range view.SelectFromContainer(nil) {
container.IP = ""
var labels []string
if children, ok := dir[container.DockerID]; ok {
json.Unmarshal([]byte(children["Labels"]), &labels)
container.IP = children["IP"]
ip := net.ParseIP(container.IP).To4()
if ip != nil {
container.Mac = fmt.Sprintf("02:00:%02x:%02x:%02x:%02x",
ip[0], ip[1], ip[2], ip[3])
}
}
if worker {
// Masters get their labels from the policy, workers from the
// etcd store.
container.Labels = labels
}
view.Commit(container)
}
}
示例2: checkSupervisorInit
func checkSupervisorInit(view db.Database) bool {
self, err := view.MinionSelf()
return err == nil && self.SupervisorInit
}