Пример #1
0
// 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 {
	return MakeRangeKey(Addr(key), localTransactionSuffix, roachpb.RKey(txnID.Bytes()))
}
Пример #2
0
// SequenceCacheKeyPrefix returns the prefix common to all sequence cache keys
// for the given transaction ID.
func SequenceCacheKeyPrefix(rangeID roachpb.RangeID, txnID *uuid.UUID) roachpb.Key {
	key := MakeRangeIDReplicatedKey(rangeID, LocalSequenceCacheSuffix, nil)
	key = encoding.EncodeBytesAscending(key, txnID.Bytes())
	return key
}