本文整理汇总了Golang中github.com/snapcore/snapd/asserts.Backstore类的典型用法代码示例。如果您正苦于以下问题:Golang Backstore类的具体用法?Golang Backstore怎么用?Golang Backstore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Backstore类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: retrieveAssertion
func (s *Store) retrieveAssertion(bs asserts.Backstore, assertType *asserts.AssertionType, primaryKey []string) (asserts.Assertion, error) {
a, err := bs.Get(assertType, primaryKey, assertType.MaxSupportedFormat())
if err == asserts.ErrNotFound && s.assertFallback {
return s.fallback.Assertion(assertType, primaryKey, nil)
}
return a, err
}
示例2: findSnapRevision
func findSnapRevision(snapDigest string, bs asserts.Backstore) (*asserts.SnapRevision, *asserts.Account, error) {
a, err := bs.Get(asserts.SnapRevisionType, []string{snapDigest}, asserts.SnapRevisionType.MaxSupportedFormat())
if err != nil {
return nil, nil, err
}
snapRev := a.(*asserts.SnapRevision)
a, err = bs.Get(asserts.AccountType, []string{snapRev.DeveloperID()}, asserts.AccountType.MaxSupportedFormat())
if err != nil {
return nil, nil, err
}
devAcct := a.(*asserts.Account)
return snapRev, devAcct, nil
}
示例3: addSnapIDs
func addSnapIDs(bs asserts.Backstore, initial map[string]string) (map[string]string, error) {
m := make(map[string]string)
for id, name := range initial {
m[id] = name
}
hit := func(a asserts.Assertion) {
decl := a.(*asserts.SnapDeclaration)
m[decl.SnapID()] = decl.SnapName()
}
err := bs.Search(asserts.SnapDeclarationType, nil, hit, asserts.SnapDeclarationType.MaxSupportedFormat())
if err != nil {
return nil, err
}
return m, nil
}