当前位置: 首页>>代码示例>>Golang>>正文


Golang KID.Equal方法代码示例

本文整理汇总了Golang中github.com/keybase/client/go/protocol.KID.Equal方法的典型用法代码示例。如果您正苦于以下问题:Golang KID.Equal方法的具体用法?Golang KID.Equal怎么用?Golang KID.Equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/keybase/client/go/protocol.KID的用法示例。


在下文中一共展示了KID.Equal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: LoadLinksFromStorage

func (l *SigChainLoader) LoadLinksFromStorage() (err error) {
	var curr LinkID
	var links []*ChainLink
	var mt *MerkleTriple
	goodKey := true

	uid := l.user.GetUID()

	l.G().Log.Debug("+ SigChainLoader.LoadFromStorage(%s)", uid)
	defer func() { l.G().Log.Debug("- SigChainLoader.LoadFromStorage(%s) -> %s", uid, ErrToOk(err)) }()

	if mt, err = l.LoadLastLinkIDFromStorage(); err != nil || mt == nil {
		l.G().Log.Debug("| Failed to load last link ID")
		if err == nil {
			l.G().Log.Debug("| no error loading last link ID from storage")
		}
		if mt == nil {
			l.G().Log.Debug("| mt (MerkleTriple) nil result from load last link ID from storage")
		}
		return err
	}

	// Load whatever the last fingerprint was in the chain if we're not loading
	// allKeys. We have to load something...  Note that we don't use l.fp
	// here (as we used to) since if the user used to have chainlinks, and then
	// removed their key, we still want to load their last chainlinks.
	var loadKID keybase1.KID

	curr = mt.LinkID
	var link *ChainLink

	suid := l.selfUID()

	for curr != nil && goodKey {
		l.G().VDL.Log(VLog1, "| loading link; curr=%s", curr)
		if link, err = ImportLinkFromStorage(curr, suid, l.G()); err != nil {
			return
		}
		kid2 := link.ToEldestKID()

		if loadKID.IsNil() {
			loadKID = kid2
			l.G().Log.Debug("| Setting loadKID=%s", kid2)
		} else if !l.allKeys && loadKID.Exists() && !loadKID.Equal(kid2) {
			goodKey = false
			l.G().Log.Debug("| Stop loading at KID=%s (!= KID=%s)", loadKID, kid2)
		}

		if goodKey {
			links = append(links, link)
			curr = link.GetPrev()
		}
	}

	reverse(links)
	l.G().Log.Debug("| Loaded %d links", len(links))

	l.links = links
	return
}
开发者ID:jacobhaven,项目名称:client,代码行数:60,代码来源:sig_chain.go


注:本文中的github.com/keybase/client/go/protocol.KID.Equal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。