private static SinglePartitionReadCommand maybeConvertNamesToSlice(SinglePartitionReadCommand command) { if (command.clusteringIndexFilter().kind() != ClusteringIndexFilter.Kind.NAMES) return command; CFMetaData metadata = command.metadata(); if (!shouldConvertNamesToSlice(metadata, command.columnFilter().fetchedColumns())) return command; ClusteringIndexNamesFilter filter = (ClusteringIndexNamesFilter)command.clusteringIndexFilter(); ClusteringIndexSliceFilter sliceFilter = convertNamesFilterToSliceFilter(filter, metadata); return command.withUpdatedClusteringIndexFilter(sliceFilter); }
private static SinglePartitionReadCommand maybeConvertNamesToSlice(SinglePartitionReadCommand command) { if (command.clusteringIndexFilter().kind() != ClusteringIndexFilter.Kind.NAMES) return command; CFMetaData metadata = command.metadata(); if (!shouldConvertNamesToSlice(metadata, command.columnFilter().fetchedColumns())) return command; ClusteringIndexNamesFilter filter = (ClusteringIndexNamesFilter)command.clusteringIndexFilter(); ClusteringIndexSliceFilter sliceFilter = convertNamesFilterToSliceFilter(filter, metadata); return command.withUpdatedClusteringIndexFilter(sliceFilter); }
private static SinglePartitionReadCommand maybeConvertNamesToSlice(SinglePartitionReadCommand command) { if (command.clusteringIndexFilter().kind() != ClusteringIndexFilter.Kind.NAMES) return command; CFMetaData metadata = command.metadata(); if (!shouldConvertNamesToSlice(metadata, command.columnFilter().fetchedColumns())) return command; ClusteringIndexNamesFilter filter = (ClusteringIndexNamesFilter)command.clusteringIndexFilter(); ClusteringIndexSliceFilter sliceFilter = convertNamesFilterToSliceFilter(filter, metadata); return command.withUpdatedClusteringIndexFilter(sliceFilter); }
public void serialize(ReadCommand command, DataOutputPlus out, int version) throws IOException { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); CFMetaData metadata = singleReadCommand.metadata(); out.writeByte(LegacyType.fromPartitionFilterKind(singleReadCommand.clusteringIndexFilter().kind()).serializedValue); out.writeBoolean(singleReadCommand.isDigestQuery()); out.writeUTF(metadata.ksName); ByteBufferUtil.writeWithShortLength(singleReadCommand.partitionKey().getKey(), out); out.writeUTF(metadata.cfName); out.writeLong(singleReadCommand.nowInSec() * 1000L); // convert from seconds to millis if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) serializeSliceCommand(singleReadCommand, out); else serializeNamesCommand(singleReadCommand, out); }
public void serialize(ReadCommand command, DataOutputPlus out, int version) throws IOException { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); CFMetaData metadata = singleReadCommand.metadata(); out.writeByte(LegacyType.fromPartitionFilterKind(singleReadCommand.clusteringIndexFilter().kind()).serializedValue); out.writeBoolean(singleReadCommand.isDigestQuery()); out.writeUTF(metadata.ksName); ByteBufferUtil.writeWithShortLength(singleReadCommand.partitionKey().getKey(), out); out.writeUTF(metadata.cfName); out.writeLong(singleReadCommand.nowInSec() * 1000L); // convert from seconds to millis if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) serializeSliceCommand(singleReadCommand, out); else serializeNamesCommand(singleReadCommand, out); }
public void serialize(ReadCommand command, DataOutputPlus out, int version) throws IOException { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); CFMetaData metadata = singleReadCommand.metadata(); out.writeByte(LegacyType.fromPartitionFilterKind(singleReadCommand.clusteringIndexFilter().kind()).serializedValue); out.writeBoolean(singleReadCommand.isDigestQuery()); out.writeUTF(metadata.ksName); ByteBufferUtil.writeWithShortLength(singleReadCommand.partitionKey().getKey(), out); out.writeUTF(metadata.cfName); out.writeLong(singleReadCommand.nowInSec() * 1000L); // convert from seconds to millis if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) serializeSliceCommand(singleReadCommand, out); else serializeNamesCommand(singleReadCommand, out); }
public long serializedSize(ReadCommand command, int version) { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); int keySize = singleReadCommand.partitionKey().getKey().remaining(); CFMetaData metadata = singleReadCommand.metadata(); long size = 1; // message type (single byte) size += TypeSizes.sizeof(command.isDigestQuery()); size += TypeSizes.sizeof(metadata.ksName); size += TypeSizes.sizeof((short) keySize) + keySize; size += TypeSizes.sizeof((long) command.nowInSec()); if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) return size + serializedSliceCommandSize(singleReadCommand); else return size + serializedNamesCommandSize(singleReadCommand); }
public long serializedSize(ReadCommand command, int version) { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); int keySize = singleReadCommand.partitionKey().getKey().remaining(); CFMetaData metadata = singleReadCommand.metadata(); long size = 1; // message type (single byte) size += TypeSizes.sizeof(command.isDigestQuery()); size += TypeSizes.sizeof(metadata.ksName); size += TypeSizes.sizeof((short) keySize) + keySize; size += TypeSizes.sizeof((long) command.nowInSec()); if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) return size + serializedSliceCommandSize(singleReadCommand); else return size + serializedNamesCommandSize(singleReadCommand); }
public long serializedSize(ReadCommand command, int version) { assert version < MessagingService.VERSION_30; assert command.kind == Kind.SINGLE_PARTITION; SinglePartitionReadCommand singleReadCommand = (SinglePartitionReadCommand) command; singleReadCommand = maybeConvertNamesToSlice(singleReadCommand); int keySize = singleReadCommand.partitionKey().getKey().remaining(); CFMetaData metadata = singleReadCommand.metadata(); long size = 1; // message type (single byte) size += TypeSizes.sizeof(command.isDigestQuery()); size += TypeSizes.sizeof(metadata.ksName); size += TypeSizes.sizeof((short) keySize) + keySize; size += TypeSizes.sizeof((long) command.nowInSec()); if (singleReadCommand.clusteringIndexFilter().kind() == ClusteringIndexFilter.Kind.SLICE) return size + serializedSliceCommandSize(singleReadCommand); else return size + serializedNamesCommandSize(singleReadCommand); }
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else
if (rangeCommand.dataRange().clusteringIndexFilter.kind() == ClusteringIndexFilter.Kind.NAMES) filter = LegacyReadCommandSerializer.convertNamesFilterToSliceFilter((ClusteringIndexNamesFilter) rangeCommand.dataRange().clusteringIndexFilter, metadata); else