本文整理汇总了Java中org.apache.cassandra.dht.AbstractBounds类的典型用法代码示例。如果您正苦于以下问题:Java AbstractBounds类的具体用法?Java AbstractBounds怎么用?Java AbstractBounds使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractBounds类属于org.apache.cassandra.dht包,在下文中一共展示了AbstractBounds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PagedRangeCommand
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public PagedRangeCommand(String keyspace,
String columnFamily,
long timestamp,
AbstractBounds<RowPosition> keyRange,
SliceQueryFilter predicate,
Composite start,
Composite stop,
List<IndexExpression> rowFilter,
int limit,
boolean countCQL3Rows)
{
super(keyspace, columnFamily, timestamp, keyRange, predicate, rowFilter);
this.start = start;
this.stop = stop;
this.limit = limit;
this.countCQL3Rows = countCQL3Rows;
}
示例2: deserialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public RangeSliceCommand deserialize(DataInput in, int version) throws IOException
{
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
long timestamp = in.readLong();
CFMetaData metadata = Schema.instance.getCFMetaData(keyspace, columnFamily);
IDiskAtomFilter predicate = metadata.comparator.diskAtomFilterSerializer().deserialize(in, version);
List<IndexExpression> rowFilter;
int filterCount = in.readInt();
rowFilter = new ArrayList<>(filterCount);
for (int i = 0; i < filterCount; i++)
{
rowFilter.add(IndexExpression.readFrom(in));
}
AbstractBounds<RowPosition> range = AbstractBounds.serializer.deserialize(in, version).toRowBounds();
int maxResults = in.readInt();
boolean countCQL3Rows = in.readBoolean();
boolean isPaging = in.readBoolean();
return new RangeSliceCommand(keyspace, columnFamily, timestamp, predicate, range, rowFilter, maxResults, countCQL3Rows, isPaging);
}
示例3: serialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public void serialize(PagedRangeCommand cmd, DataOutput out, int version) throws IOException
{
out.writeUTF(cmd.keyspace);
out.writeUTF(cmd.columnFamily);
out.writeLong(cmd.timestamp);
AbstractBounds.serializer.serialize(cmd.keyRange, out, version);
// SliceQueryFilter (the count is not used)
SliceQueryFilter filter = (SliceQueryFilter)cmd.predicate;
SliceQueryFilter.serializer.serialize(filter, out, version);
// The start and stop of the page
ByteBufferUtil.writeWithShortLength(cmd.start, out);
ByteBufferUtil.writeWithShortLength(cmd.stop, out);
out.writeInt(cmd.rowFilter.size());
for (IndexExpression expr : cmd.rowFilter)
{
ByteBufferUtil.writeWithShortLength(expr.column, out);
out.writeInt(expr.operator.ordinal());
ByteBufferUtil.writeWithLength(expr.value, out);
}
out.writeInt(cmd.limit);
}
示例4: deserialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public PagedRangeCommand deserialize(DataInput in, int version) throws IOException
{
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
long timestamp = in.readLong();
AbstractBounds<RowPosition> keyRange = AbstractBounds.serializer.deserialize(in, version).toRowBounds();
SliceQueryFilter predicate = SliceQueryFilter.serializer.deserialize(in, version);
ByteBuffer start = ByteBufferUtil.readWithShortLength(in);
ByteBuffer stop = ByteBufferUtil.readWithShortLength(in);
int filterCount = in.readInt();
List<IndexExpression> rowFilter = new ArrayList<IndexExpression>(filterCount);
for (int i = 0; i < filterCount; i++)
{
IndexExpression expr = new IndexExpression(ByteBufferUtil.readWithShortLength(in),
IndexExpression.Operator.findByOrdinal(in.readInt()),
ByteBufferUtil.readWithShortLength(in));
rowFilter.add(expr);
}
int limit = in.readInt();
return new PagedRangeCommand(keyspace, columnFamily, timestamp, keyRange, predicate, start, stop, rowFilter, limit);
}
示例5: serializedSize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public long serializedSize(PagedRangeCommand cmd, int version)
{
long size = 0;
size += TypeSizes.NATIVE.sizeof(cmd.keyspace);
size += TypeSizes.NATIVE.sizeof(cmd.columnFamily);
size += TypeSizes.NATIVE.sizeof(cmd.timestamp);
size += AbstractBounds.serializer.serializedSize(cmd.keyRange, version);
size += SliceQueryFilter.serializer.serializedSize((SliceQueryFilter)cmd.predicate, version);
size += TypeSizes.NATIVE.sizeof(cmd.rowFilter.size());
for (IndexExpression expr : cmd.rowFilter)
{
size += TypeSizes.NATIVE.sizeofWithShortLength(expr.column);
size += TypeSizes.NATIVE.sizeof(expr.operator.ordinal());
size += TypeSizes.NATIVE.sizeofWithLength(expr.value);
}
size += TypeSizes.NATIVE.sizeof(cmd.limit);
return size;
}
示例6: serialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public void serialize(RepairJobDesc desc, DataOutputPlus out, int version) throws IOException
{
if (version >= MessagingService.VERSION_21)
{
out.writeBoolean(desc.parentSessionId != null);
if (desc.parentSessionId != null)
UUIDSerializer.serializer.serialize(desc.parentSessionId, out, version);
}
UUIDSerializer.serializer.serialize(desc.sessionId, out, version);
out.writeUTF(desc.keyspace);
out.writeUTF(desc.columnFamily);
MessagingService.validatePartitioner(desc.ranges);
out.writeInt(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
AbstractBounds.tokenSerializer.serialize(rt, out, version);
}
示例7: deserialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public RepairJobDesc deserialize(DataInputPlus in, int version) throws IOException
{
UUID parentSessionId = null;
if (version >= MessagingService.VERSION_21)
{
if (in.readBoolean())
parentSessionId = UUIDSerializer.serializer.deserialize(in, version);
}
UUID sessionId = UUIDSerializer.serializer.deserialize(in, version);
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
int nRanges = in.readInt();
Collection<Range<Token>> ranges = new ArrayList<>();
Range<Token> range;
for (int i = 0; i < nRanges; i++)
{
range = (Range<Token>) AbstractBounds.tokenSerializer.deserialize(in,
MessagingService.globalPartitioner(), version);
ranges.add(range);
}
return new RepairJobDesc(parentSessionId, sessionId, keyspace, columnFamily, ranges);
}
示例8: serializedSize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public long serializedSize(RepairJobDesc desc, int version)
{
int size = 0;
if (version >= MessagingService.VERSION_21)
{
size += TypeSizes.sizeof(desc.parentSessionId != null);
if (desc.parentSessionId != null)
size += UUIDSerializer.serializer.serializedSize(desc.parentSessionId, version);
}
size += UUIDSerializer.serializer.serializedSize(desc.sessionId, version);
size += TypeSizes.sizeof(desc.keyspace);
size += TypeSizes.sizeof(desc.columnFamily);
size += TypeSizes.sizeof(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
{
size += AbstractBounds.tokenSerializer.serializedSize(rt, version);
}
return size;
}
示例9: testSSTablesInBounds
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
@Test
public void testSSTablesInBounds()
{
ColumnFamilyStore cfs = MockSchema.newCFS();
View initialView = fakeView(0, 5, cfs);
for (int i = 0 ; i < 5 ; i++)
{
for (int j = i ; j < 5 ; j++)
{
PartitionPosition min = MockSchema.readerBounds(i);
PartitionPosition max = MockSchema.readerBounds(j);
for (boolean minInc : new boolean[] { true })//, false} )
{
for (boolean maxInc : new boolean[] { true })//, false} )
{
if (i == j && !(minInc && maxInc))
continue;
AbstractBounds<PartitionPosition> bounds = AbstractBounds.bounds(min, minInc, max, maxInc);
List<SSTableReader> r = ImmutableList.copyOf(initialView.liveSSTablesInBounds(bounds.left, bounds.right));
Assert.assertEquals(String.format("%d(%s) %d(%s)", i, minInc, j, maxInc), j - i + (minInc ? 0 : -1) + (maxInc ? 1 : 0), r.size());
}
}
}
}
}
示例10: serialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public void serialize(StreamRequest srm, DataOutput dos, int version) throws IOException
{
UUIDSerializer.serializer.serialize(srm.sessionId, dos, MessagingService.current_version);
CompactEndpointSerializationHelper.serialize(srm.target, dos);
if (srm.file != null)
{
dos.writeBoolean(true);
PendingFile.serializer.serialize(srm.file, dos, version);
}
else
{
dos.writeBoolean(false);
dos.writeUTF(srm.table);
dos.writeInt(srm.ranges.size());
for (Range<Token> range : srm.ranges)
AbstractBounds.serializer.serialize(range, dos, version);
dos.writeUTF(srm.type.name());
dos.writeInt(Iterables.size(srm.columnFamilies));
for (ColumnFamilyStore cfs : srm.columnFamilies)
ColumnFamily.serializer.serializeCfId(cfs.metadata.cfId, dos, version);
}
}
示例11: serializedSize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public long serializedSize(StreamRequest sr, int version)
{
long size = TypeSizes.NATIVE.sizeof(sr.sessionId);
size += CompactEndpointSerializationHelper.serializedSize(sr.target);
size += TypeSizes.NATIVE.sizeof(true);
if (sr.file != null)
return size + PendingFile.serializer.serializedSize(sr.file, version);
size += TypeSizes.NATIVE.sizeof(sr.table);
size += TypeSizes.NATIVE.sizeof(sr.ranges.size());
for (Range<Token> range : sr.ranges)
size += AbstractBounds.serializer.serializedSize(range, version);
size += TypeSizes.NATIVE.sizeof(sr.type.name());
size += TypeSizes.NATIVE.sizeof(Iterables.size(sr.columnFamilies));
for (ColumnFamilyStore cfs : sr.columnFamilies)
size += ColumnFamily.serializer.cfIdSerializedSize(cfs.metadata.cfId, TypeSizes.NATIVE, version);
return size;
}
示例12: BigTableScanner
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
private BigTableScanner(SSTableReader sstable, ColumnFilter columns, DataRange dataRange, RateLimiter limiter, boolean isForThrift, Iterator<AbstractBounds<PartitionPosition>> rangeIterator)
{
assert sstable != null;
this.dfile = limiter == null ? sstable.openDataReader() : sstable.openDataReader(limiter);
this.ifile = sstable.openIndexReader();
this.sstable = sstable;
this.columns = columns;
this.dataRange = dataRange;
this.rowIndexEntrySerializer = sstable.descriptor.version.getSSTableFormat().getIndexSerializer(sstable.metadata,
sstable.descriptor.version,
sstable.header);
this.isForThrift = isForThrift;
this.rangeIterator = rangeIterator;
}
示例13: makeBounds
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
private static List<AbstractBounds<PartitionPosition>> makeBounds(SSTableReader sstable, Collection<Range<Token>> tokenRanges)
{
List<AbstractBounds<PartitionPosition>> boundsList = new ArrayList<>(tokenRanges.size());
for (Range<Token> range : Range.normalize(tokenRanges))
addRange(sstable, Range.makeRowRange(range), boundsList);
return boundsList;
}
示例14: addRange
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
private static void addRange(SSTableReader sstable, AbstractBounds<PartitionPosition> requested, List<AbstractBounds<PartitionPosition>> boundsList)
{
if (requested instanceof Range && ((Range)requested).isWrapAround())
{
if (requested.right.compareTo(sstable.first) >= 0)
{
// since we wrap, we must contain the whole sstable prior to stopKey()
Boundary<PartitionPosition> left = new Boundary<PartitionPosition>(sstable.first, true);
Boundary<PartitionPosition> right;
right = requested.rightBoundary();
right = minRight(right, sstable.last, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
if (requested.left.compareTo(sstable.last) <= 0)
{
// since we wrap, we must contain the whole sstable after dataRange.startKey()
Boundary<PartitionPosition> right = new Boundary<PartitionPosition>(sstable.last, true);
Boundary<PartitionPosition> left;
left = requested.leftBoundary();
left = maxLeft(left, sstable.first, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
}
else
{
assert requested.left.compareTo(requested.right) <= 0 || requested.right.isMinimum();
Boundary<PartitionPosition> left, right;
left = requested.leftBoundary();
right = requested.rightBoundary();
left = maxLeft(left, sstable.first, true);
// apparently isWrapAround() doesn't count Bounds that extend to the limit (min) as wrapping
right = requested.right.isMinimum() ? new Boundary<PartitionPosition>(sstable.last, true)
: minRight(right, sstable.last, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
}
示例15: serialize
import org.apache.cassandra.dht.AbstractBounds; //导入依赖的package包/类
public void serialize(RepairJobDesc desc, DataOutputPlus out, int version) throws IOException
{
if (version >= MessagingService.VERSION_21)
{
out.writeBoolean(desc.parentSessionId != null);
if (desc.parentSessionId != null)
UUIDSerializer.serializer.serialize(desc.parentSessionId, out, version);
}
UUIDSerializer.serializer.serialize(desc.sessionId, out, version);
out.writeUTF(desc.keyspace);
out.writeUTF(desc.columnFamily);
AbstractBounds.serializer.serialize(desc.range, out, version);
}