本文整理匯總了Golang中github.com/cockroachdb/cockroach/proto.ClientCmdID.WallTime方法的典型用法代碼示例。如果您正苦於以下問題:Golang ClientCmdID.WallTime方法的具體用法?Golang ClientCmdID.WallTime怎麽用?Golang ClientCmdID.WallTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/proto.ClientCmdID
的用法示例。
在下文中一共展示了ClientCmdID.WallTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: decodeResponseCacheKey
func (rc *ResponseCache) decodeResponseCacheKey(encKey proto.EncodedKey) (proto.ClientCmdID, error) {
ret := proto.ClientCmdID{}
key, _, isValue := engine.MVCCDecodeKey(encKey)
if isValue {
return ret, util.Errorf("key %s is not a raw MVCC value", encKey)
}
if !bytes.HasPrefix(key, keys.LocalRangeIDPrefix) {
return ret, util.Errorf("key %s does not have %s prefix", key, keys.LocalRangeIDPrefix)
}
// Cut the prefix and the Raft ID.
b := key[len(keys.LocalRangeIDPrefix):]
b, _ = encoding.DecodeUvarint(b)
if !bytes.HasPrefix(b, keys.LocalResponseCacheSuffix) {
return ret, util.Errorf("key %s does not contain the response cache suffix %s",
key, keys.LocalResponseCacheSuffix)
}
// Cut the response cache suffix.
b = b[len(keys.LocalResponseCacheSuffix):]
// Now, decode the command ID.
b, wt := encoding.DecodeUvarint(b)
b, rd := encoding.DecodeUint64(b)
if len(b) > 0 {
return ret, util.Errorf("key %s has leftover bytes after decode: %s; indicates corrupt key",
encKey, b)
}
ret.WallTime = int64(wt)
ret.Random = int64(rd)
return ret, nil
}