本文整理汇总了Java中org.apache.cassandra.db.RowIndexEntry.create方法的典型用法代码示例。如果您正苦于以下问题:Java RowIndexEntry.create方法的具体用法?Java RowIndexEntry.create怎么用?Java RowIndexEntry.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.RowIndexEntry
的用法示例。
在下文中一共展示了RowIndexEntry.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testKeyCacheValueWithDelInfo
import org.apache.cassandra.db.RowIndexEntry; //导入方法依赖的package包/类
@Test
public void testKeyCacheValueWithDelInfo()
{
RowIndexEntry entry = RowIndexEntry.create(123, new DeletionTime(123, 123), ColumnIndex.nothing());
long size = entry.memorySize();
long size2 = meter.measureDeep(entry);
Assert.assertEquals(size, size2);
}
示例2: append
import org.apache.cassandra.db.RowIndexEntry; //导入方法依赖的package包/类
/**
* Appends partition data to this writer.
*
* @param iterator the partition to write
* @return the created index entry if something was written, that is if {@code iterator}
* wasn't empty, {@code null} otherwise.
*
* @throws FSWriteError if a write to the dataFile fails
*/
public RowIndexEntry append(UnfilteredRowIterator iterator)
{
DecoratedKey key = iterator.partitionKey();
if (key.getKey().remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
{
logger.error("Key size {} exceeds maximum of {}, skipping row", key.getKey().remaining(), FBUtilities.MAX_UNSIGNED_SHORT);
return null;
}
if (iterator.isEmpty())
return null;
long startPosition = beforeAppend(key);
observers.forEach((o) -> o.startPartition(key, iwriter.indexFile.position()));
//Reuse the writer for each row
columnIndexWriter.reset();
try (UnfilteredRowIterator collecting = Transformation.apply(iterator, new StatsCollector(metadataCollector)))
{
columnIndexWriter.buildRowIndex(collecting);
// afterAppend() writes the partition key before the first RowIndexEntry - so we have to add it's
// serialized size to the index-writer position
long indexFilePosition = ByteBufferUtil.serializedSizeWithShortLength(key.getKey()) + iwriter.indexFile.position();
RowIndexEntry entry = RowIndexEntry.create(startPosition, indexFilePosition,
collecting.partitionLevelDeletion(),
columnIndexWriter.headerLength,
columnIndexWriter.columnIndexCount,
columnIndexWriter.indexInfoSerializedSize(),
columnIndexWriter.indexSamples(),
columnIndexWriter.offsets(),
getRowIndexEntrySerializer().indexInfoSerializer());
long endPosition = dataFile.position();
long rowSize = endPosition - startPosition;
maybeLogLargePartitionWarning(key, rowSize);
metadataCollector.addPartitionSizeInBytes(rowSize);
afterAppend(key, endPosition, entry, columnIndexWriter.buffer());
return entry;
}
catch (IOException e)
{
throw new FSWriteError(e, dataFile.getPath());
}
}