本文整理汇总了Java中org.apache.cassandra.io.sstable.IndexHelper类的典型用法代码示例。如果您正苦于以下问题:Java IndexHelper类的具体用法?Java IndexHelper怎么用?Java IndexHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexHelper类属于org.apache.cassandra.io.sstable包,在下文中一共展示了IndexHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:IndexedSliceReader.java
示例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);
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:22,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:RowIndexEntry.java
示例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);
}
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:20,代码来源:SimpleSliceReader.java
示例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);
}
}
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:21,代码来源:IndexedSliceReader.java
示例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);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:RowIndexEntry.java
示例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);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:13,代码来源:RowIndexEntry.java
示例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());
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:13,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:36,代码来源:ColumnIndex.java
示例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);
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:14,代码来源:RowIndexEntry.java
示例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);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:12,代码来源:RowIndexEntry.java
示例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;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:16,代码来源:RowIndexEntry.java
示例16: 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 = column.serializedSizeForSSTable();
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);
lastColumn = column;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:36,代码来源:ColumnIndex.java
示例17: create
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
public static RowIndexEntry<IndexHelper.IndexInfo> create(long position, DeletionTime deletionTime, ColumnIndex index)
{
assert index != null;
assert deletionTime != null;
// we only consider the columns summary when determining whether to create an IndexedEntry,
// since if there are insufficient columns to be worth indexing we're going to seek to
// the beginning of the row anyway, so we might as well read the tombstone there as well.
if (index.columnsIndex.size() > 1)
return new IndexedEntry(position, deletionTime, index.partitionHeaderLength, index.columnsIndex);
else
return new RowIndexEntry<>(position);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:RowIndexEntry.java
示例18: IndexedEntry
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
private IndexedEntry(long position, DeletionTime deletionTime, long headerLength, List<IndexHelper.IndexInfo> columnsIndex)
{
super(position);
assert deletionTime != null;
assert columnsIndex != null && columnsIndex.size() > 1;
this.deletionTime = deletionTime;
this.headerLength = headerLength;
this.columnsIndex = columnsIndex;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:RowIndexEntry.java
示例19: promotedSize
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
@Override
protected int promotedSize(IndexHelper.IndexInfo.Serializer idxSerializer)
{
long size = TypeSizes.sizeofUnsignedVInt(headerLength)
+ DeletionTime.serializer.serializedSize(deletionTime)
+ TypeSizes.sizeofUnsignedVInt(columnsIndex.size()); // number of entries
for (IndexHelper.IndexInfo info : columnsIndex)
size += idxSerializer.serializedSize(info);
size += columnsIndex.size() * TypeSizes.sizeof(0);
return Ints.checkedCast(size);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:RowIndexEntry.java
示例20: ColumnIndex
import org.apache.cassandra.io.sstable.IndexHelper; //导入依赖的package包/类
private ColumnIndex(long partitionHeaderLength, List<IndexHelper.IndexInfo> columnsIndex)
{
assert columnsIndex != null;
this.partitionHeaderLength = partitionHeaderLength;
this.columnsIndex = columnsIndex;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:ColumnIndex.java
注:本文中的org.apache.cassandra.io.sstable.IndexHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论