本文整理汇总了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)
}