当前位置: 首页>>代码示例>>Java>>正文


Java RowIndexEntry.create方法代码示例

本文整理汇总了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);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:9,代码来源:ObjectSizeTest.java

示例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());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:58,代码来源:BigTableWriter.java


注:本文中的org.apache.cassandra.db.RowIndexEntry.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。