public long serializedSize(PartitionPosition pos, int version) { Kind kind = pos.kind(); int size = 1; // 1 byte for enum if (kind == Kind.ROW_KEY) { int keySize = ((DecoratedKey)pos).getKey().remaining(); size += TypeSizes.sizeof((short) keySize) + keySize; } else { size += Token.serializer.serializedSize(pos.getToken(), version); } return size; } }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
public int compareCustom(ByteBuffer o1, ByteBuffer o2) { // o1 and o2 can be empty so we need to use PartitionPosition, not DecoratedKey return PartitionPosition.ForKey.get(o1, partitioner).compareTo(PartitionPosition.ForKey.get(o2, partitioner)); }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public boolean isLimitedToOnePartition() { return dataRange.keyRange instanceof Bounds && dataRange.startKey().kind() == PartitionPosition.Kind.ROW_KEY && dataRange.startKey().equals(dataRange.stopKey()); }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public boolean isLimitedToOnePartition() { return dataRange.keyRange instanceof Bounds && dataRange.startKey().kind() == PartitionPosition.Kind.ROW_KEY && dataRange.startKey().equals(dataRange.stopKey()); }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
public long serializedSize(PartitionPosition pos, int version) { Kind kind = pos.kind(); int size = 1; // 1 byte for enum if (kind == Kind.ROW_KEY) { int keySize = ((DecoratedKey)pos).getKey().remaining(); size += TypeSizes.sizeof((short) keySize) + keySize; } else { size += Token.serializer.serializedSize(pos.getToken(), version); } return size; } }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public boolean isLimitedToOnePartition() { return dataRange.keyRange instanceof Bounds && dataRange.startKey().kind() == PartitionPosition.Kind.ROW_KEY && dataRange.startKey().equals(dataRange.stopKey()); }
private Paging(AbstractBounds<PartitionPosition> range, ClusteringIndexFilter filter, ClusteringComparator comparator, Clustering lastReturned, boolean inclusive) { super(range, filter); // When using a paging range, we don't allow wrapped ranges, as it's unclear how to handle them properly. // This is ok for now since we only need this in range queries, and the range are "unwrapped" in that case. assert !(range instanceof Range) || !((Range<?>)range).isWrapAround() || range.right.isMinimum() : range; assert lastReturned != null; this.comparator = comparator; this.lastReturned = lastReturned; this.inclusive = inclusive; }
public long serializedSize(PartitionPosition pos, int version) { Kind kind = pos.kind(); int size = 1; // 1 byte for enum if (kind == Kind.ROW_KEY) { int keySize = ((DecoratedKey)pos).getKey().remaining(); size += TypeSizes.sizeof((short) keySize) + keySize; } else { size += Token.serializer.serializedSize(pos.getToken(), version); } return size; } }
/** * Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away, * modulo downsampling of the index summary). Always returns a {@code value >= 0} */ public long getIndexScanPosition(PartitionPosition key) { if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0) key = first; return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary); }