本文整理匯總了Golang中github.com/cockroachdb/cockroach/util/interval.RangeGroup.Add方法的典型用法代碼示例。如果您正苦於以下問題:Golang RangeGroup.Add方法的具體用法?Golang RangeGroup.Add怎麽用?Golang RangeGroup.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/util/interval.RangeGroup
的用法示例。
在下文中一共展示了RangeGroup.Add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addKeyRange
// addKeyRange adds the specified key range to the range group,
// taking care not to add this range if existing entries already
// completely cover the range.
func addKeyRange(keys interval.RangeGroup, start, end roachpb.Key) {
// This gives us a memory-efficient end key if end is empty.
// The most common case for keys in the intents interval map
// is for single keys. However, the range group requires
// a non-empty interval, so we create two key slices which
// share the same underlying byte array.
if len(end) == 0 {
end = start.Next()
start = end[:len(start)]
}
keyR := interval.Range{
Start: interval.Comparable(start),
End: interval.Comparable(end),
}
keys.Add(keyR)
}