本文整理匯總了Golang中github.com/cockroachdb/cockroach/gossip.BootstrapInfo.Timestamp方法的典型用法代碼示例。如果您正苦於以下問題:Golang BootstrapInfo.Timestamp方法的具體用法?Golang BootstrapInfo.Timestamp怎麽用?Golang BootstrapInfo.Timestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/gossip.BootstrapInfo
的用法示例。
在下文中一共展示了BootstrapInfo.Timestamp方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: WriteBootstrapInfo
// WriteBootstrapInfo implements the gossip.Storage interface. Write
// persists the supplied bootstrap info to every known store. Returns
// nil on success; otherwise returns first error encountered writing
// to the stores.
func (ls *Stores) WriteBootstrapInfo(bi *gossip.BootstrapInfo) error {
ls.mu.RLock()
defer ls.mu.RUnlock()
bi.Timestamp = ls.clock.Now()
if err := ls.updateBootstrapInfo(bi); err != nil {
return err
}
log.Infof("wrote %d node addresses to persistent storage", len(bi.Addresses))
return nil
}
示例2: WriteBootstrapInfo
// WriteBootstrapInfo implements the gossip.Storage interface. Write
// persists the supplied bootstrap info to every known store. Returns
// nil on success; otherwise returns first error encountered writing
// to the stores.
func (ls *Stores) WriteBootstrapInfo(bi *gossip.BootstrapInfo) error {
ls.mu.RLock()
defer ls.mu.RUnlock()
ls.biLatestTS = ls.clock.Now()
bi.Timestamp = ls.biLatestTS
for _, s := range ls.storeMap {
if err := engine.MVCCPutProto(s.engine, nil, keys.StoreGossipKey(), roachpb.ZeroTimestamp, nil, bi); err != nil {
return err
}
log.Infof("wrote gossip bootstrap info to %s", s)
}
return nil
}