static long serializedRowFilterSize(RowFilter rowFilter) { long size = TypeSizes.sizeof(0); // rowFilterCount for (RowFilter.Expression expression : rowFilter) { size += ByteBufferUtil.serializedSizeWithShortLength(expression.column().name.bytes); size += TypeSizes.sizeof(0); // operator int value size += ByteBufferUtil.serializedSizeWithShortLength(expression.getIndexValue()); } return size; }
static long serializedRowFilterSize(RowFilter rowFilter) { long size = TypeSizes.sizeof(0); // rowFilterCount for (RowFilter.Expression expression : rowFilter) { size += ByteBufferUtil.serializedSizeWithShortLength(expression.column().name.bytes); size += TypeSizes.sizeof(0); // operator int value size += ByteBufferUtil.serializedSizeWithShortLength(expression.getIndexValue()); } return size; }
static long serializedRowFilterSize(RowFilter rowFilter) { long size = TypeSizes.sizeof(0); // rowFilterCount for (RowFilter.Expression expression : rowFilter) { size += ByteBufferUtil.serializedSizeWithShortLength(expression.column().name.bytes); size += TypeSizes.sizeof(0); // operator int value size += ByteBufferUtil.serializedSizeWithShortLength(expression.getIndexValue()); } return size; }
static long serializedStaticSliceSize(CFMetaData metadata) { // unlike serializeStaticSlice(), but we don't care about reversal for size calculations ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, ClusteringBound.BOTTOM, false); long size = ByteBufferUtil.serializedSizeWithShortLength(sliceStart); size += TypeSizes.sizeof((short) (metadata.comparator.size() * 3 + 2)); size += TypeSizes.sizeof((short) LegacyLayout.STATIC_PREFIX); for (int i = 0; i < metadata.comparator.size(); i++) { size += ByteBufferUtil.serializedSizeWithShortLength(ByteBufferUtil.EMPTY_BYTE_BUFFER); size += 1; // EOC } return size; }
static long serializedStaticSliceSize(CFMetaData metadata) { // unlike serializeStaticSlice(), but we don't care about reversal for size calculations ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, ClusteringBound.BOTTOM, false); long size = ByteBufferUtil.serializedSizeWithShortLength(sliceStart); size += TypeSizes.sizeof((short) (metadata.comparator.size() * 3 + 2)); size += TypeSizes.sizeof((short) LegacyLayout.STATIC_PREFIX); for (int i = 0; i < metadata.comparator.size(); i++) { size += ByteBufferUtil.serializedSizeWithShortLength(ByteBufferUtil.EMPTY_BYTE_BUFFER); size += 1; // EOC } return size; }
static long serializedStaticSliceSize(CFMetaData metadata) { // unlike serializeStaticSlice(), but we don't care about reversal for size calculations ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, ClusteringBound.BOTTOM, false); long size = ByteBufferUtil.serializedSizeWithShortLength(sliceStart); size += TypeSizes.sizeof((short) (metadata.comparator.size() * 3 + 2)); size += TypeSizes.sizeof((short) LegacyLayout.STATIC_PREFIX); for (int i = 0; i < metadata.comparator.size(); i++) { size += ByteBufferUtil.serializedSizeWithShortLength(ByteBufferUtil.EMPTY_BYTE_BUFFER); size += 1; // EOC } return size; }
public int serializedSize(ProtocolVersion protocolVersion) { assert rowMark == null || protocolVersion == rowMark.protocolVersion; ByteBuffer pk = partitionKey == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : partitionKey; ByteBuffer mark = rowMark == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : rowMark.mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { return ByteBufferUtil.serializedSizeWithShortLength(pk) + ByteBufferUtil.serializedSizeWithShortLength(mark) + 8; // remaining & remainingInPartition } else { return ByteBufferUtil.serializedSizeWithVIntLength(pk) + ByteBufferUtil.serializedSizeWithVIntLength(mark) + TypeSizes.sizeofUnsignedVInt(remaining) + TypeSizes.sizeofUnsignedVInt(remainingInPartition); } }
public int serializedSize(ProtocolVersion protocolVersion) { assert rowMark == null || protocolVersion == rowMark.protocolVersion; ByteBuffer pk = partitionKey == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : partitionKey; ByteBuffer mark = rowMark == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : rowMark.mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { return ByteBufferUtil.serializedSizeWithShortLength(pk) + ByteBufferUtil.serializedSizeWithShortLength(mark) + 8; // remaining & remainingInPartition } else { return ByteBufferUtil.serializedSizeWithVIntLength(pk) + ByteBufferUtil.serializedSizeWithVIntLength(mark) + TypeSizes.sizeofUnsignedVInt(remaining) + TypeSizes.sizeofUnsignedVInt(remainingInPartition); } }
public int serializedSize(ProtocolVersion protocolVersion) { assert rowMark == null || protocolVersion == rowMark.protocolVersion; ByteBuffer pk = partitionKey == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : partitionKey; ByteBuffer mark = rowMark == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : rowMark.mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { return ByteBufferUtil.serializedSizeWithShortLength(pk) + ByteBufferUtil.serializedSizeWithShortLength(mark) + 8; // remaining & remainingInPartition } else { return ByteBufferUtil.serializedSizeWithVIntLength(pk) + ByteBufferUtil.serializedSizeWithVIntLength(mark) + TypeSizes.sizeofUnsignedVInt(remaining) + TypeSizes.sizeofUnsignedVInt(remainingInPartition); } }
public int serializedSize(ProtocolVersion protocolVersion) { assert rowMark == null || protocolVersion == rowMark.protocolVersion; ByteBuffer pk = partitionKey == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : partitionKey; ByteBuffer mark = rowMark == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : rowMark.mark; if (protocolVersion.isSmallerOrEqualTo(ProtocolVersion.V3)) { return ByteBufferUtil.serializedSizeWithShortLength(pk) + ByteBufferUtil.serializedSizeWithShortLength(mark) + 8; // remaining & remainingInPartition } else { return ByteBufferUtil.serializedSizeWithVIntLength(pk) + ByteBufferUtil.serializedSizeWithVIntLength(mark) + TypeSizes.sizeofUnsignedVInt(remaining) + TypeSizes.sizeofUnsignedVInt(remainingInPartition); } }
static long serializedNamesFilterSize(ClusteringIndexNamesFilter filter, CFMetaData metadata, PartitionColumns fetchedColumns) { SortedSet<Clustering> requestedRows = filter.requestedRows(); long size = 0; if (requestedRows.isEmpty()) { // only static columns are requested size += TypeSizes.sizeof(fetchedColumns.size()); for (ColumnDefinition column : fetchedColumns) size += ByteBufferUtil.serializedSizeWithShortLength(column.name.bytes); } else { size += TypeSizes.sizeof(requestedRows.size() * fetchedColumns.size()); for (Clustering clustering : requestedRows) { for (ColumnDefinition column : fetchedColumns) size += ByteBufferUtil.serializedSizeWithShortLength(LegacyLayout.encodeCellName(metadata, clustering, column.name.bytes, null)); } } return size + TypeSizes.sizeof(true); // countCql3Rows }
static long serializedSlicesSize(Slices slices, boolean makeStaticSlice, CFMetaData metadata) { long size = TypeSizes.sizeof(slices.size()); for (Slice slice : slices) { ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, slice.start(), true); size += ByteBufferUtil.serializedSizeWithShortLength(sliceStart); ByteBuffer sliceEnd = LegacyLayout.encodeBound(metadata, slice.end(), false); size += ByteBufferUtil.serializedSizeWithShortLength(sliceEnd); } if (makeStaticSlice) size += serializedStaticSliceSize(metadata); return size; }
static long serializedSlicesSize(Slices slices, boolean makeStaticSlice, CFMetaData metadata) { long size = TypeSizes.sizeof(slices.size()); for (Slice slice : slices) { ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, slice.start(), true); size += ByteBufferUtil.serializedSizeWithShortLength(sliceStart); ByteBuffer sliceEnd = LegacyLayout.encodeBound(metadata, slice.end(), false); size += ByteBufferUtil.serializedSizeWithShortLength(sliceEnd); } if (makeStaticSlice) size += serializedStaticSliceSize(metadata); return size; }
static long serializedSlicesSize(Slices slices, boolean makeStaticSlice, CFMetaData metadata) { long size = TypeSizes.sizeof(slices.size()); for (Slice slice : slices) { ByteBuffer sliceStart = LegacyLayout.encodeBound(metadata, slice.start(), true); size += ByteBufferUtil.serializedSizeWithShortLength(sliceStart); ByteBuffer sliceEnd = LegacyLayout.encodeBound(metadata, slice.end(), false); size += ByteBufferUtil.serializedSizeWithShortLength(sliceEnd); } if (makeStaticSlice) size += serializedStaticSliceSize(metadata); return size; }
public long serializedSize(Commit commit, int version) { int size = 0; if (version < MessagingService.VERSION_30) size += ByteBufferUtil.serializedSizeWithShortLength(commit.update.partitionKey().getKey()); return size + UUIDSerializer.serializer.serializedSize(commit.ballot, version) + PartitionUpdate.serializer.serializedSize(commit.update, version); } }
public long serializedSize(Commit commit, int version) { int size = 0; if (version < MessagingService.VERSION_30) size += ByteBufferUtil.serializedSizeWithShortLength(commit.update.partitionKey().getKey()); return size + UUIDSerializer.serializer.serializedSize(commit.ballot, version) + PartitionUpdate.serializer.serializedSize(commit.update, version); } }
public long serializedSize(Commit commit, int version) { int size = 0; if (version < MessagingService.VERSION_30) size += ByteBufferUtil.serializedSizeWithShortLength(commit.update.partitionKey().getKey()); return size + UUIDSerializer.serializer.serializedSize(commit.ballot, version) + PartitionUpdate.serializer.serializedSize(commit.update, version); } }
private long serializedSizeSimple() { long size = 0; List<AbstractType<?>> types = new ArrayList<>(comparator.clusteringComparator.subtypes()); assert types.size() == 1 : types; for (int i = 0; i < this.size; i++) { LegacyBound start = starts[i]; LegacyBound end = ends[i]; ClusteringPrefix startClustering = start.bound.clustering(); ClusteringPrefix endClustering = end.bound.clustering(); assert startClustering.size() == 1; assert endClustering.size() == 1; size += ByteBufferUtil.serializedSizeWithShortLength(startClustering.get(0)); size += ByteBufferUtil.serializedSizeWithShortLength(endClustering.get(0)); size += TypeSizes.sizeof(delTimes[i]); size += TypeSizes.sizeof(markedAts[i]); } return size; } }
public long serializedSize(ReadResponse response, int version) { assert version < MessagingService.VERSION_30; long size = TypeSizes.sizeof(0); // number of partitions assert response.command != null; // we only serialize LocalDataResponse, which always has the command set try (UnfilteredPartitionIterator iterator = response.makeIterator(response.command)) { while (iterator.hasNext()) { try (UnfilteredRowIterator partition = iterator.next()) { size += ByteBufferUtil.serializedSizeWithShortLength(partition.partitionKey().getKey()); size += LegacyLayout.serializedSizeAsLegacyPartition(response.command, partition, version); } } } return size; } }
public long serializedSize(ReadResponse response, int version) { assert version < MessagingService.VERSION_30; long size = TypeSizes.sizeof(0); // number of partitions assert response.command != null; // we only serialize LocalDataResponse, which always has the command set try (UnfilteredPartitionIterator iterator = response.makeIterator(response.command)) { while (iterator.hasNext()) { try (UnfilteredRowIterator partition = iterator.next()) { size += ByteBufferUtil.serializedSizeWithShortLength(partition.partitionKey().getKey()); size += LegacyLayout.serializedSizeAsLegacyPartition(response.command, partition, version); } } } return size; } }