本文整理汇总了Java中org.apache.cassandra.io.sstable.IndexHelper类的典型用法代码示例。如果您正苦于以下问题:Java IndexHelper类的具体用法?Java IndexHelper怎么用?Java IndexHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexHelper类属于org.apache.cassandra.io.sstable包,在下文中一共展示了IndexHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public RowIndexEntry deserialize(DataInput in, Descriptor.Version version) throws IOException
{
long position = in.readLong();
int size = in.readInt();
if (size > 0)
{
DeletionTime deletionTime = DeletionTime.serializer.deserialize(in);
int entries = in.readInt();
ISerializer<IndexHelper.IndexInfo> idxSerializer = type.indexSerializer();
List<IndexHelper.IndexInfo> columnsIndex = new ArrayList<IndexHelper.IndexInfo>(entries);
for (int i = 0; i < entries; i++)
columnsIndex.add(idxSerializer.deserialize(in));
return new IndexedEntry(position, deletionTime, columnsIndex);
}
else
{
return new RowIndexEntry(position);
}
}
示例2: serializedSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public int serializedSize(RowIndexEntry rie)
{
int size = TypeSizes.NATIVE.sizeof(rie.position) + TypeSizes.NATIVE.sizeof(rie.promotedSize(type));
if (rie.isIndexed())
{
List<IndexHelper.IndexInfo> index = rie.columnsIndex();
size += DeletionTime.serializer.serializedSize(rie.deletionTime(), TypeSizes.NATIVE);
size += TypeSizes.NATIVE.sizeof(index.size());
ISerializer<IndexHelper.IndexInfo> idxSerializer = type.indexSerializer();
for (IndexHelper.IndexInfo info : index)
size += idxSerializer.serializedSize(info, TypeSizes.NATIVE);
}
return size;
}
示例3: setNextSlice
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
protected boolean setNextSlice()
{
while (++currentSliceIdx < slices.length)
{
nextIndexIdx = IndexHelper.indexFor(slices[currentSliceIdx].start, indexes, comparator, reversed, nextIndexIdx);
if (nextIndexIdx < 0 || nextIndexIdx >= indexes.size())
// no index block for that slice
continue;
// Check if we can exclude this slice entirely from the index
IndexInfo info = indexes.get(nextIndexIdx);
if (reversed)
{
if (!isBeforeSliceStart(info.lastName))
return true;
}
else
{
if (!isAfterSliceFinish(info.firstName))
return true;
}
}
nextIndexIdx = -1;
return false;
}
示例4: deserialize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public RowIndexEntry deserialize(DataInput in, Descriptor.Version version) throws IOException
{
long position = in.readLong();
int size = in.readInt();
if (size > 0)
{
DeletionTime deletionTime = DeletionTime.serializer.deserialize(in);
int entries = in.readInt();
List<IndexHelper.IndexInfo> columnsIndex = new ArrayList<IndexHelper.IndexInfo>(entries);
for (int i = 0; i < entries; i++)
columnsIndex.add(IndexHelper.IndexInfo.deserialize(in));
return new IndexedEntry(position, deletionTime, columnsIndex);
}
else
{
return new RowIndexEntry(position);
}
}
示例5: serializedSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public int serializedSize(RowIndexEntry<IndexHelper.IndexInfo> rie)
{
assert version.storeRows() : "We read old index files but we should never write them";
int indexedSize = 0;
if (rie.isIndexed())
{
List<IndexHelper.IndexInfo> index = rie.columnsIndex();
indexedSize += TypeSizes.sizeofUnsignedVInt(rie.headerLength());
indexedSize += DeletionTime.serializer.serializedSize(rie.deletionTime());
indexedSize += TypeSizes.sizeofUnsignedVInt(index.size());
for (IndexHelper.IndexInfo info : index)
indexedSize += idxSerializer.serializedSize(info);
indexedSize += index.size() * TypeSizes.sizeof(0);
}
return TypeSizes.sizeofUnsignedVInt(rie.position) + TypeSizes.sizeofUnsignedVInt(indexedSize) + indexedSize;
}
示例6: SimpleSliceReader
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public SimpleSliceReader(SSTableReader sstable, FileDataInput input, ByteBuffer finishColumn)
{
this.file = input;
this.finishColumn = finishColumn;
comparator = sstable.metadata.comparator;
try
{
IndexHelper.skipBloomFilter(file);
IndexHelper.skipIndex(file);
emptyColumnFamily = ColumnFamily.serializer().deserializeFromSSTableNoColumns(ColumnFamily.create(sstable.metadata), file);
columns = file.readInt();
mark = file.mark();
}
catch (IOException e)
{
throw new IOError(e);
}
}
示例7: IndexedSliceReader
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public IndexedSliceReader(SSTableReader sstable, FileDataInput input, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed)
{
this.file = input;
this.startColumn = startColumn;
this.finishColumn = finishColumn;
this.reversed = reversed;
comparator = sstable.metadata.comparator;
try
{
IndexHelper.skipBloomFilter(file);
indexes = IndexHelper.deserializeIndex(file);
emptyColumnFamily = ColumnFamily.serializer().deserializeFromSSTableNoColumns(ColumnFamily.create(sstable.metadata), file);
fetcher = indexes == null ? new SimpleBlockFetcher() : new IndexedBlockFetcher();
}
catch (IOException e)
{
throw new IOError(e);
}
}
示例8: serialize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public void serialize(RowIndexEntry rie, DataOutputPlus out) throws IOException
{
out.writeLong(rie.position);
out.writeInt(rie.promotedSize(type));
if (rie.isIndexed())
{
DeletionTime.serializer.serialize(rie.deletionTime(), out);
out.writeInt(rie.columnsIndex().size());
ISerializer<IndexHelper.IndexInfo> idxSerializer = type.indexSerializer();
for (IndexHelper.IndexInfo info : rie.columnsIndex())
idxSerializer.serialize(info, out);
}
}
示例9: IndexedEntry
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
private IndexedEntry(long position, DeletionTime deletionTime, List<IndexHelper.IndexInfo> columnsIndex)
{
super(position);
assert deletionTime != null;
assert columnsIndex != null && columnsIndex.size() > 1;
this.deletionTime = deletionTime;
this.columnsIndex = columnsIndex;
}
示例10: promotedSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
@Override
public int promotedSize(CType type)
{
TypeSizes typeSizes = TypeSizes.NATIVE;
long size = DeletionTime.serializer.serializedSize(deletionTime, typeSizes);
size += typeSizes.sizeof(columnsIndex.size()); // number of entries
ISerializer<IndexHelper.IndexInfo> idxSerializer = type.indexSerializer();
for (IndexHelper.IndexInfo info : columnsIndex)
size += idxSerializer.serializedSize(info, typeSizes);
return Ints.checkedCast(size);
}
示例11: unsharedHeapSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
@Override
public long unsharedHeapSize()
{
long entrySize = 0;
for (IndexHelper.IndexInfo idx : columnsIndex)
entrySize += idx.unsharedHeapSize();
return BASE_SIZE
+ entrySize
+ deletionTime.unsharedHeapSize()
+ ObjectSizes.sizeOfReferenceArray(columnsIndex.size());
}
示例12: add
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public void add(OnDiskAtom column) throws IOException
{
atomCount++;
if (firstColumn == null)
{
firstColumn = column;
startPosition = endPosition;
// TODO: have that use the firstColumn as min + make sure we optimize that on read
endPosition += tombstoneTracker.writeOpenedMarker(firstColumn, output, atomSerializer);
blockSize = 0; // We don't count repeated tombstone marker in the block size, to avoid a situation
// where we wouldn't make any progress because a block is filled by said marker
}
long size = atomSerializer.serializedSizeForSSTable(column);
endPosition += size;
blockSize += size;
// if we hit the column index size that we have to index after, go ahead and index it.
if (blockSize >= DatabaseDescriptor.getColumnIndexSize())
{
IndexHelper.IndexInfo cIndexInfo = new IndexHelper.IndexInfo(firstColumn.name(), column.name(), indexOffset + startPosition, endPosition - startPosition);
result.columnsIndex.add(cIndexInfo);
firstColumn = null;
lastBlockClosing = column;
}
maybeWriteRowHeader();
atomSerializer.serializeForSSTable(column, output);
// TODO: Should deal with removing unneeded tombstones
tombstoneTracker.update(column, false);
lastColumn = column;
}
示例13: serialize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public void serialize(RowIndexEntry rie, DataOutput out) throws IOException
{
out.writeLong(rie.position);
out.writeInt(rie.promotedSize());
if (rie.isIndexed())
{
DeletionTime.serializer.serialize(rie.deletionTime(), out);
out.writeInt(rie.columnsIndex().size());
for (IndexHelper.IndexInfo info : rie.columnsIndex())
info.serialize(out);
}
}
示例14: promotedSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
@Override
public int promotedSize()
{
TypeSizes typeSizes = TypeSizes.NATIVE;
long size = DeletionTime.serializer.serializedSize(deletionTime, typeSizes);
size += typeSizes.sizeof(columnsIndex.size()); // number of entries
for (IndexHelper.IndexInfo info : columnsIndex)
size += info.serializedSize(typeSizes);
return Ints.checkedCast(size);
}
示例15: memorySize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
@Override
public long memorySize()
{
long entrySize = 0;
for (IndexHelper.IndexInfo idx : columnsIndex)
entrySize += idx.memorySize();
return ObjectSizes.getSuperClassFieldSize(TypeSizes.NATIVE.sizeof(position))
+ ObjectSizes.getFieldSize(// deletionTime
ObjectSizes.getReferenceSize() +
// columnsIndex
ObjectSizes.getReferenceSize())
+ deletionTime.memorySize()
+ ObjectSizes.getArraySize(columnsIndex.size(), ObjectSizes.getReferenceSize()) + entrySize + 4;
}