@Internal public class ByteStringRangeHelper extends java.lang.Object
Constructor and Description |
---|
ByteStringRangeHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
coverSameKeySpace(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> parentPartitions,
com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange childPartition)
Returns true if parentPartitions form a proper superset of childPartition.
|
static boolean |
doPartitionsOverlap(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange first,
com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange second)
Returns true if the two ByteStringRange overlaps, otherwise false.
|
static java.lang.String |
formatByteStringRange(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange partition)
Returns formatted string of a partition for debugging.
|
static com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange |
getIntersectingPartition(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange p1,
com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange p2)
Return the overlapping parts of 2 partitions.
|
static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> |
getMissingPartitionsFrom(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions,
com.google.protobuf.ByteString start,
com.google.protobuf.ByteString end)
Return missing partitions within partitions that are within start and end.
|
static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> |
getMissingPartitionsFromEntireKeySpace(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
Return missing partitions from the entire keyspace.
|
static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> |
getOverlappingPartitions(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
Return a list of overlapping partitions.
|
static boolean |
isValidPartition(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange partition)
Checks if the partition's start key is before its end key.
|
static java.lang.String |
partitionsToString(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
Convert partitions to a string for debugging.
|
public static boolean coverSameKeySpace(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> parentPartitions, com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange childPartition)
If ordered parentPartitions row ranges form a contiguous range without any overlaps, and start key equals to childPartition's start key, and end key equals to childPartition's end key, then parentPartitions form a proper superset of childPartition.
Returns false if there are overlaps or missing partitions in parentPartitions.
parentPartitions
- list of partitions to determine if it forms an exact contiguous rangechildPartition
- the partition to matchpublic static java.lang.String partitionsToString(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
partitions
- to printpublic static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> getMissingPartitionsFrom(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions, com.google.protobuf.ByteString start, com.google.protobuf.ByteString end)
partitions
- find missing partitions withinstart
- start of the search rangeend
- end of the search rangepublic static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> getMissingPartitionsFromEntireKeySpace(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
partitions
- find missing partitions withinpublic static java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> getOverlappingPartitions(java.util.List<com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange> partitions)
partitions
- find overlaps withinpublic static java.lang.String formatByteStringRange(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange partition)
partition
- partition to format.public static boolean doPartitionsOverlap(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange first, com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange second)
Assume the two ByteStringRange are valid such that the start <= end. There are 2 scenarios that's considered NOT overlapping. Otherwise, they are overlapping.
first
- first ByteStringRangesecond
- second ByteStringRangepublic static boolean isValidPartition(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange partition)
partition
- the partition to verify.public static com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange getIntersectingPartition(com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange p1, com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange p2) throws java.lang.IllegalArgumentException
p1
- first partitionp2
- second partitionjava.lang.IllegalArgumentException
- if the 2 partitions don't overlap at all