本文整理匯總了Golang中github.com/youtube/vitess/go/zk.Stat.Version方法的典型用法代碼示例。如果您正苦於以下問題:Golang Stat.Version方法的具體用法?Golang Stat.Version怎麽用?Golang Stat.Version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/zk.Stat
的用法示例。
在下文中一共展示了Stat.Version方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: updateTabletEndpoint
func (zkts *Server) updateTabletEndpoint(oldValue string, oldStat zk.Stat, addr *topo.VtnsAddr) (newValue string, err error) {
if oldStat == nil {
// The incoming object doesn't exist - we haven't been placed in the serving
// graph yet, so don't update. Assume the next process that rebuilds the graph
// will get the updated tablet location.
return "", skipUpdateErr
}
var addrs *topo.VtnsAddrs
if oldValue != "" {
addrs, err = topo.NewVtnsAddrs(oldValue, oldStat.Version())
if err != nil {
return
}
foundTablet := false
for i, entry := range addrs.Entries {
if entry.Uid == addr.Uid {
foundTablet = true
if !topo.VtnsAddrEquality(&entry, addr) {
addrs.Entries[i] = *addr
}
break
}
}
if !foundTablet {
addrs.Entries = append(addrs.Entries, *addr)
}
} else {
addrs = topo.NewAddrs()
addrs.Entries = append(addrs.Entries, *addr)
}
return jscfg.ToJson(addrs), nil
}