本文整理汇总了Golang中github.com/ubuntu-core/snappy/overlord/state.State.Tasks方法的典型用法代码示例。如果您正苦于以下问题:Golang State.Tasks方法的具体用法?Golang State.Tasks怎么用?Golang State.Tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ubuntu-core/snappy/overlord/state.State
的用法示例。
在下文中一共展示了State.Tasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: checkChangeConflict
func checkChangeConflict(s *state.State, snapName string) error {
for _, task := range s.Tasks() {
k := task.Kind()
chg := task.Change()
if (k == "link-snap" || k == "unlink-snap") && (chg == nil || !chg.Status().Ready()) {
ss, err := TaskSnapSetup(task)
if err != nil {
return fmt.Errorf("internal error: cannot obtain snap setup from task: %s", task.Summary())
}
if ss.Name == snapName {
return fmt.Errorf("snap %q has changes in progress", snapName)
}
}
}
return nil
}
示例2: verifyInstallUpdateTasks
func verifyInstallUpdateTasks(c *C, curActive bool, ts *state.TaskSet, st *state.State) {
i := 0
n := 5
if curActive {
n++
}
c.Assert(ts.Tasks(), HasLen, n)
// all tasks are accounted
c.Assert(st.Tasks(), HasLen, n)
c.Assert(ts.Tasks()[i].Kind(), Equals, "download-snap")
i++
c.Assert(ts.Tasks()[i].Kind(), Equals, "mount-snap")
i++
if curActive {
c.Assert(ts.Tasks()[i].Kind(), Equals, "unlink-current-snap")
i++
}
c.Assert(ts.Tasks()[i].Kind(), Equals, "copy-snap-data")
i++
c.Assert(ts.Tasks()[i].Kind(), Equals, "setup-profiles")
i++
c.Assert(ts.Tasks()[i].Kind(), Equals, "link-snap")
}