本文整理汇总了Golang中launchpad/net/juju-core/state/multiwatcher.Store类的典型用法代码示例。如果您正苦于以下问题:Golang Store类的具体用法?Golang Store怎么用?Golang Store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Store类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updated
func (u *backingUnit) updated(st *State, store *multiwatcher.Store, id interface{}) error {
info := ¶ms.UnitInfo{
Name: u.Name,
Service: u.Service,
Series: u.Series,
PublicAddress: u.PublicAddress,
PrivateAddress: u.PrivateAddress,
MachineId: u.MachineId,
Ports: u.Ports,
}
if u.CharmURL != nil {
info.CharmURL = u.CharmURL.String()
}
oldInfo := store.Get(info.EntityId())
if oldInfo == nil {
// We're adding the entry for the first time,
// so fetch the associated unit status.
sdoc, err := getStatus(st, unitGlobalKey(u.Name))
if err != nil {
return err
}
info.Status = sdoc.Status
info.StatusInfo = sdoc.StatusInfo
} else {
// The entry already exists, so preserve the current status.
oldInfo := oldInfo.(*params.UnitInfo)
info.Status = oldInfo.Status
info.StatusInfo = oldInfo.StatusInfo
}
store.Update(info)
return nil
}
示例2: removed
func (svc *backingMachine) removed(st *State, store *multiwatcher.Store, id interface{}) error {
store.Remove(params.EntityId{
Kind: "machine",
Id: id,
})
return nil
}