當前位置: 首頁>>代碼示例>>Golang>>正文


Golang changelist.Changelist類代碼示例

本文整理匯總了Golang中github.com/docker/notary/client/changelist.Changelist的典型用法代碼示例。如果您正苦於以下問題:Golang Changelist類的具體用法?Golang Changelist怎麽用?Golang Changelist使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Changelist類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: applyChangelist

func applyChangelist(repo *tuf.Repo, cl changelist.Changelist) error {
	it, err := cl.NewIterator()
	if err != nil {
		return err
	}
	index := 0
	for it.HasNext() {
		c, err := it.Next()
		if err != nil {
			return err
		}
		isDel := data.IsDelegation(c.Scope())
		switch {
		case c.Scope() == changelist.ScopeTargets || isDel:
			err = applyTargetsChange(repo, c)
		case c.Scope() == changelist.ScopeRoot:
			err = applyRootChange(repo, c)
		default:
			logrus.Debug("scope not supported: ", c.Scope())
		}
		index++
		if err != nil {
			return err
		}
	}
	logrus.Debugf("applied %d change(s)", index)
	return nil
}
開發者ID:qingqi,項目名稱:docker,代碼行數:28,代碼來源:helpers.go

示例2: applyChangelist

func applyChangelist(repo *tuf.TufRepo, cl changelist.Changelist) error {
	it, err := cl.NewIterator()
	if err != nil {
		return err
	}
	index := 0
	for it.HasNext() {
		c, err := it.Next()
		if err != nil {
			return err
		}
		switch c.Scope() {
		case changelist.ScopeTargets:
			err := applyTargetsChange(repo, c)
			if err != nil {
				return err
			}
		default:
			logrus.Debug("scope not supported: ", c.Scope())
		}
		index++
	}
	logrus.Debugf("applied %d change(s)", index)
	return nil
}
開發者ID:waterytowers,項目名稱:global-hack-day-3,代碼行數:25,代碼來源:helpers.go

示例3: applyChangelist

func applyChangelist(repo *tuf.Repo, invalid *tuf.Repo, cl changelist.Changelist) error {
	it, err := cl.NewIterator()
	if err != nil {
		return err
	}
	index := 0
	for it.HasNext() {
		c, err := it.Next()
		if err != nil {
			return err
		}
		isDel := data.IsDelegation(c.Scope()) || data.IsWildDelegation(c.Scope())
		switch {
		case c.Scope() == changelist.ScopeTargets || isDel:
			err = applyTargetsChange(repo, invalid, c)
		case c.Scope() == changelist.ScopeRoot:
			err = applyRootChange(repo, c)
		default:
			return fmt.Errorf("scope not supported: %s", c.Scope())
		}
		if err != nil {
			logrus.Debugf("error attempting to apply change #%d: %s, on scope: %s path: %s type: %s", index, c.Action(), c.Scope(), c.Path(), c.Type())
			return err
		}
		index++
	}
	logrus.Debugf("applied %d change(s)", index)
	return nil
}
開發者ID:jfrazelle,項目名稱:notary,代碼行數:29,代碼來源:helpers.go

示例4: applyChangelist

func applyChangelist(repo *tuf.TufRepo, cl changelist.Changelist) error {
	changes := cl.List()
	var err error
	for _, c := range changes {
		if c.Scope() == "targets" {
			applyTargetsChange(repo, c)
		}
		if err != nil {
			return err
		}
	}
	return nil
}
開發者ID:ChanderG,項目名稱:docker,代碼行數:13,代碼來源:helpers.go

示例5: applyChangelist

func applyChangelist(repo *tuf.TufRepo, cl changelist.Changelist) error {
	changes := cl.List()
	logrus.Debugf("applying %d changes", len(changes))
	for _, c := range changes {
		switch c.Scope() {
		case changelist.ScopeTargets:
			err := applyTargetsChange(repo, c)
			if err != nil {
				return err
			}
		default:
			logrus.Debug("scope not supported: ", c.Scope())
		}
	}
	return nil
}
開發者ID:souravbh,項目名稱:lattice-release,代碼行數:16,代碼來源:helpers.go

示例6: rootFileKeyChange

func (r *NotaryRepository) rootFileKeyChange(cl changelist.Changelist, role, action string, key data.PublicKey) error {
	kl := make(data.KeyList, 0, 1)
	kl = append(kl, key)
	meta := changelist.TufRootData{
		RoleName: role,
		Keys:     kl,
	}
	metaJSON, err := json.Marshal(meta)
	if err != nil {
		return err
	}

	c := changelist.NewTufChange(
		action,
		changelist.ScopeRoot,
		changelist.TypeRootRole,
		role,
		metaJSON,
	)
	return cl.Add(c)
}
開發者ID:CadeLaRen,項目名稱:docker-3,代碼行數:21,代碼來源:client.go


注:本文中的github.com/docker/notary/client/changelist.Changelist類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。