本文整理汇总了Golang中github.com/cockroachdb/cockroach/pkg/util/uuid.UUID类的典型用法代码示例。如果您正苦于以下问题:Golang UUID类的具体用法?Golang UUID怎么用?Golang UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UUID类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TransactionKey
// TransactionKey returns a transaction key based on the provided
// transaction key and ID. The base key is encoded in order to
// guarantee that all transaction records for a range sort together.
func TransactionKey(key roachpb.Key, txnID *uuid.UUID) roachpb.Key {
rk, err := Addr(key)
if err != nil {
panic(err)
}
return MakeRangeKey(rk, localTransactionSuffix, roachpb.RKey(txnID.GetBytes()))
}
开发者ID:knz,项目名称:cockroach,代码行数:10,代码来源:keys.go
示例2: fillUUID
func fillUUID(b byte) uuid.UUID {
var ret uuid.UUID
for i := range ret.GetBytes() {
ret.UUID[i] = b
}
return ret
}
开发者ID:hvaara,项目名称:cockroach,代码行数:7,代码来源:abort_cache.go
示例3: assertTS
// assertTS is a helper function for layeredIntervalTestCase
// validators. It queries the timestamp cache for the given keys and
// reports a test error if it doesn't match the given timestamp and
// transaction ID.
func assertTS(
t *testing.T,
tc *timestampCache,
start, end roachpb.Key,
expectedTS hlc.Timestamp,
expectedTxnID *uuid.UUID,
) {
var keys string
if len(end) == 0 {
keys = fmt.Sprintf("%q", start)
} else {
keys = fmt.Sprintf("%q-%q", start, end)
}
ts, txnID, _ := tc.GetMaxRead(start, end)
if !ts.Equal(expectedTS) {
t.Errorf("expected %s to have timestamp %v, found %v", keys, expectedTS, ts)
}
if expectedTxnID == nil {
if txnID != nil {
t.Errorf("expected %s to have no txn id, but found %s", keys, txnID.Short())
}
} else {
if txnID == nil {
t.Errorf("expected %s to have txn id %s, but found nil", keys, expectedTxnID.Short())
} else if *txnID != *expectedTxnID {
t.Errorf("expected %s to have txn id %s, but found %s",
keys, expectedTxnID.Short(), txnID.Short())
}
}
}
开发者ID:hvaara,项目名称:cockroach,代码行数:34,代码来源:timestamp_cache_test.go
示例4: AbortCacheKey
// AbortCacheKey returns a range-local key by Range ID for an
// abort cache entry, with detail specified by encoding the
// supplied transaction ID.
func AbortCacheKey(rangeID roachpb.RangeID, txnID *uuid.UUID) roachpb.Key {
key := MakeRangeIDReplicatedKey(rangeID, LocalAbortCacheSuffix, nil)
key = encoding.EncodeBytesAscending(key, txnID.GetBytes())
return key
}
开发者ID:knz,项目名称:cockroach,代码行数:8,代码来源:keys.go
注:本文中的github.com/cockroachdb/cockroach/pkg/util/uuid.UUID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论