• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ColumnSlice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.db.filter.ColumnSlice的典型用法代码示例。如果您正苦于以下问题:Java ColumnSlice类的具体用法?Java ColumnSlice怎么用?Java ColumnSlice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ColumnSlice类属于org.apache.cassandra.db.filter包,在下文中一共展示了ColumnSlice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: computeNext

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected Cell computeNext()
{
    while (currentSlice != null || idx < slices.length)
    {
        if (currentSlice == null)
        {
            ColumnSlice slice = slices[idx++];
            if (forwards)
                currentSlice = slice(btree, comparator, slice.start, slice.finish, true);
            else
                currentSlice = slice(btree, comparator, slice.finish, slice.start, false);
        }

        if (currentSlice.hasNext())
            return currentSlice.next();

        currentSlice = null;
    }

    return endOfData();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:AtomicBTreeColumns.java


示例2: computeNext

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected Cell computeNext()
{
    if (currentSlice == null)
    {
        if (idx >= slices.length)
            return endOfData();

        ColumnSlice slice = slices[idx++];
        if (forwards)
            currentSlice = slice(btree, comparator, slice.start, slice.finish, true);
        else
            currentSlice = slice(btree, comparator, slice.finish, slice.start, false);
    }

    if (currentSlice.hasNext())
        return currentSlice.next();

    currentSlice = null;
    return computeNext();
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:21,代码来源:AtomicBTreeColumns.java


示例3: collectionColumns

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected Iterator<Cell> collectionColumns(CellName collection, ColumnFamily cf, final long now)
{
    // We are testing for collection equality, so we need to have the expected values *and* only those.
    ColumnSlice[] collectionSlice = new ColumnSlice[]{ collection.slice() };
    // Filter live columns, this makes things simpler afterwards
    return Iterators.filter(cf.iterator(collectionSlice), new Predicate<Cell>()
    {
        public boolean apply(Cell c)
        {
            // we only care about live columns
            return c.isLive(now);
        }
    });
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:ColumnCondition.java


示例4: AbstractCType

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected AbstractCType(boolean isByteOrderComparable)
{
    reverseComparator = new Comparator<Composite>()
    {
        public int compare(Composite c1, Composite c2)
        {
            return AbstractCType.this.compare(c2, c1);
        }
    };
    indexComparator = new Comparator<IndexInfo>()
    {
        public int compare(IndexInfo o1, IndexInfo o2)
        {
            return AbstractCType.this.compare(o1.lastName, o2.lastName);
        }
    };
    indexReverseComparator = new Comparator<IndexInfo>()
    {
        public int compare(IndexInfo o1, IndexInfo o2)
        {
            return AbstractCType.this.compare(o1.firstName, o2.firstName);
        }
    };

    serializer = new Serializer(this);

    indexSerializer = new IndexInfo.Serializer(this);
    sliceSerializer = new ColumnSlice.Serializer(this);
    sliceQueryFilterSerializer = new SliceQueryFilter.Serializer(this);
    deletionInfoSerializer = new DeletionInfo.Serializer(this);
    rangeTombstoneSerializer = new RangeTombstone.Serializer(this);
    rowIndexEntrySerializer = new RowIndexEntry.Serializer(this);
    this.isByteOrderComparable = isByteOrderComparable;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:35,代码来源:AbstractCType.java


示例5: iterator

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
public Iterator<Cell> iterator(ColumnSlice[] slices)
{
    maybeSortCells();
    return slices.length == 1
         ? slice(slices[0], reversed, null)
         : new SlicesIterator(slices, reversed);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ArrayBackedSortedColumns.java


示例6: reverseIterator

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
public Iterator<Cell> reverseIterator(ColumnSlice[] slices)
{
    maybeSortCells();
    return slices.length == 1
         ? slice(slices[0], !reversed, null)
         : new SlicesIterator(slices, !reversed);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ArrayBackedSortedColumns.java


示例7: SliceIterator

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
SliceIterator(Object[] btree, Comparator<Object> comparator, boolean forwards, ColumnSlice[] slices)
{
    this.btree = btree;
    this.comparator = comparator;
    this.slices = slices;
    this.forwards = forwards;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:AtomicBTreeColumns.java


示例8: IndexedSliceReader

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
/**
 * This slice reader assumes that slices are sorted correctly, e.g. that for forward lookup slices are in
 * lexicographic order of start elements and that for reverse lookup they are in reverse lexicographic order of
 * finish (reverse start) elements. i.e. forward: [a,b],[d,e],[g,h] reverse: [h,g],[e,d],[b,a]. This reader also
 * assumes that validation has been performed in terms of intervals (no overlapping intervals).
 */
public IndexedSliceReader(SSTableReader sstable, RowIndexEntry indexEntry, FileDataInput input, ColumnSlice[] slices, boolean reversed)
{
    Tracing.trace("Seeking to partition indexed section in data file");
    this.sstable = sstable;
    this.originalInput = input;
    this.reversed = reversed;
    this.slices = slices;
    this.comparator = sstable.metadata.comparator;
    this.rangeTombstonesReversed = reversed ? new ArrayDeque<OnDiskAtom>() : null;

    try
    {
        this.indexes = indexEntry.columnsIndex();
        emptyColumnFamily = ArrayBackedSortedColumns.factory.create(sstable.metadata);
        if (indexes.isEmpty())
        {
            setToRowStart(indexEntry, input);
            emptyColumnFamily.delete(DeletionTime.serializer.deserialize(file));
            fetcher = new SimpleBlockFetcher();
        }
        else
        {
            emptyColumnFamily.delete(indexEntry.deletionTime());
            fetcher = new IndexedBlockFetcher(indexEntry.position);
        }
    }
    catch (IOException e)
    {
        sstable.markSuspect();
        throw new CorruptSSTableException(e, file.getPath());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:39,代码来源:IndexedSliceReader.java


示例9: fixOptionalSliceParameters

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
/**
 * Set the to start-of end-of value of "" for start and finish.
 * @param columnSlice
 */
private static void fixOptionalSliceParameters(org.apache.cassandra.thrift.ColumnSlice columnSlice) {
    if (!columnSlice.isSetStart())
        columnSlice.setStart(new byte[0]);
    if (!columnSlice.isSetFinish())
        columnSlice.setFinish(new byte[0]);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:CassandraServer.java


示例10: testIteratorInternal

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
private void testIteratorInternal(boolean reversed)
{
    CellNameType type = new SimpleDenseCellNameType(Int32Type.instance);
    ColumnFamily map = ArrayBackedSortedColumns.factory.create(metadata(), reversed);

    int[] values = new int[]{ 1, 2, 3, 5, 9 };

    for (int i = 0; i < values.length; ++i)
        map.addColumn(new BufferCell(type.makeCellName(values[reversed ? values.length - 1 - i : i])));

    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(3), Composites.EMPTY) }));
    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(4), Composites.EMPTY) }));

    assertSame(map.iterator(), map.iterator(ColumnSlice.ALL_COLUMNS_ARRAY));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:ArrayBackedSortedColumnsTest.java


示例11: computeNext

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected Column computeNext()
{
    if (currentSlice == null)
    {
        if (idx >= slices.length)
            return endOfData();

        ColumnSlice slice = slices[idx++];
        // The first idx to include
        int startIdx = slice.start.remaining() == 0 ? 0 : binarySearch(list, comparator, slice.start, previousSliceEnd);
        if (startIdx < 0)
            startIdx = -startIdx - 1;

        // The first idx to exclude
        int finishIdx = slice.finish.remaining() == 0 ? list.size() - 1 : binarySearch(list, comparator, slice.finish, previousSliceEnd);
        if (finishIdx >= 0)
            finishIdx++;
        else
            finishIdx = -finishIdx - 1;

        if (startIdx == 0 && finishIdx == list.size())
            currentSlice = list.iterator();
        else
            currentSlice = list.subList(startIdx, finishIdx).iterator();

        previousSliceEnd = finishIdx > 0 ? finishIdx - 1 : 0;
    }

    if (currentSlice.hasNext())
        return currentSlice.next();

    currentSlice = null;
    return computeNext();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:35,代码来源:ArrayBackedSortedColumns.java


示例12: IndexedSliceReader

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
/**
 * This slice reader assumes that slices are sorted correctly, e.g. that for forward lookup slices are in
 * lexicographic order of start elements and that for reverse lookup they are in reverse lexicographic order of
 * finish (reverse start) elements. i.e. forward: [a,b],[d,e],[g,h] reverse: [h,g],[e,d],[b,a]. This reader also
 * assumes that validation has been performed in terms of intervals (no overlapping intervals).
 */
public IndexedSliceReader(SSTableReader sstable, RowIndexEntry indexEntry, FileDataInput input, ColumnSlice[] slices, boolean reversed)
{
    Tracing.trace("Seeking to partition indexed section in data file");
    this.sstable = sstable;
    this.originalInput = input;
    this.reversed = reversed;
    this.slices = slices;
    this.comparator = sstable.metadata.comparator;
    this.rangeTombstonesReversed = reversed ? new ArrayDeque<OnDiskAtom>() : null;

    try
    {
        this.indexes = indexEntry.columnsIndex();
        emptyColumnFamily = EmptyColumns.factory.create(sstable.metadata);
        if (indexes.isEmpty())
        {
            setToRowStart(indexEntry, input);
            emptyColumnFamily.delete(DeletionTime.serializer.deserialize(file));
            fetcher = new SimpleBlockFetcher();
        }
        else
        {
            emptyColumnFamily.delete(indexEntry.deletionTime());
            fetcher = new IndexedBlockFetcher(indexEntry.position);
        }
    }
    catch (IOException e)
    {
        sstable.markSuspect();
        throw new CorruptSSTableException(e, file.getPath());
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:39,代码来源:IndexedSliceReader.java


示例13: testIteratorInternal

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
private void testIteratorInternal(boolean reversed)
{
    ColumnFamily map = ArrayBackedSortedColumns.factory.create(metadata(), reversed);

    int[] values = new int[]{ 1, 2, 3, 5, 9 };

    for (int i = 0; i < values.length; ++i)
        map.addColumn(new Column(ByteBufferUtil.bytes(values[reversed ? values.length - 1 - i : i])), HeapAllocator.instance);

    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(ByteBufferUtil.bytes(3), ByteBufferUtil.EMPTY_BYTE_BUFFER) }));
    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(ByteBufferUtil.bytes(4), ByteBufferUtil.EMPTY_BYTE_BUFFER) }));

    assertSame(map.iterator(), map.iterator(ColumnSlice.ALL_COLUMNS_ARRAY));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:15,代码来源:ArrayBackedSortedColumnsTest.java


示例14: computeNext

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected IColumn computeNext()
{
    if (currentSlice == null)
    {
        if (idx >= slices.length)
            return endOfData();

        ColumnSlice slice = slices[idx++];
        // The first idx to include
        int startIdx = slice.start.remaining() == 0 ? 0 : binarySearch(list, comparator, slice.start, previousSliceEnd);
        if (startIdx < 0)
            startIdx = -startIdx - 1;

        // The first idx to exclude
        int finishIdx = slice.finish.remaining() == 0 ? list.size() - 1 : binarySearch(list, comparator, slice.finish, previousSliceEnd);
        if (finishIdx >= 0)
            finishIdx++;
        else
            finishIdx = -finishIdx - 1;

        if (startIdx == 0 && finishIdx == list.size())
            currentSlice = list.iterator();
        else
            currentSlice = list.subList(startIdx, finishIdx).iterator();

        previousSliceEnd = finishIdx > 0 ? finishIdx - 1 : 0;
    }

    if (currentSlice.hasNext())
        return currentSlice.next();

    currentSlice = null;
    return computeNext();
}
 
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:35,代码来源:ArrayBackedSortedColumns.java


示例15: indexRow

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
/**
 * @param key row to index
 * @param cfs ColumnFamily to index row in
 * @param idxNames columns to index, in comparator order
 */
public static void indexRow(DecoratedKey key, ColumnFamilyStore cfs, Set<String> idxNames)
{
    if (logger.isDebugEnabled())
        logger.debug("Indexing row {} ", cfs.metadata.getKeyValidator().getString(key.key));

    Collection<SecondaryIndex> indexes = cfs.indexManager.getIndexesByNames(idxNames);

    switchLock.readLock().lock();
    try
    {
        // Our index lock is per-row, but we don't want to hold writes for too long, so for large rows
        // we release the lock between pages
        SliceQueryPager pager = new SliceQueryPager(cfs, key, ColumnSlice.ALL_COLUMNS_ARRAY);
        while (pager.hasNext())
        {
            synchronized (cfs.table.indexLockFor(key.key))
            {
                ColumnFamily cf = pager.next();
                ColumnFamily cf2 = cf.cloneMeShallow();
                for (IColumn column : cf)
                {
                    if (cfs.indexManager.indexes(column.name(), indexes))
                        cf2.addColumn(column);
                }
                cfs.indexManager.indexRow(key.key, cf2);
            }
        }
    }
    finally
    {
        switchLock.readLock().unlock();
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:39,代码来源:Table.java


示例16: SSTableSliceIterator

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
public SSTableSliceIterator(SSTableReader sstable, DecoratedKey key, ColumnSlice[] slices, boolean reversed)
{
    this.sstable = sstable;
    this.key = key;
    RowIndexEntry indexEntry = sstable.getPosition(key, SSTableReader.Operator.EQ);
    this.reader = indexEntry == null ? null : createReader(sstable, indexEntry, null, slices, reversed);
}
 
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:8,代码来源:SSTableSliceIterator.java


示例17: AbstractCType

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected AbstractCType()
{
    reverseComparator = new Comparator<Composite>()
    {
        public int compare(Composite c1, Composite c2)
        {
            return AbstractCType.this.compare(c2, c1);
        }
    };
    indexComparator = new Comparator<IndexInfo>()
    {
        public int compare(IndexInfo o1, IndexInfo o2)
        {
            return AbstractCType.this.compare(o1.lastName, o2.lastName);
        }
    };
    indexReverseComparator = new Comparator<IndexInfo>()
    {
        public int compare(IndexInfo o1, IndexInfo o2)
        {
            return AbstractCType.this.compare(o1.firstName, o2.firstName);
        }
    };

    serializer = new Serializer(this);

    indexSerializer = new IndexInfo.Serializer(this);
    sliceSerializer = new ColumnSlice.Serializer(this);
    sliceQueryFilterSerializer = new SliceQueryFilter.Serializer(this);
    deletionInfoSerializer = new DeletionInfo.Serializer(this);
    rangeTombstoneSerializer = new RangeTombstone.Serializer(this);
    rowIndexEntrySerializer = new RowIndexEntry.Serializer(this);
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:34,代码来源:AbstractCType.java


示例18: testIteratorInternal

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
private void testIteratorInternal(boolean reversed)
{
    CellNameType type = new SimpleDenseCellNameType(Int32Type.instance);
    ColumnFamily map = ArrayBackedSortedColumns.factory.create(metadata(), reversed);

    int[] values = new int[]{ 1, 2, 3, 5, 9 };

    for (int i = 0; i < values.length; ++i)
        map.addColumn(new Cell(type.makeCellName(values[reversed ? values.length - 1 - i : i])), HeapAllocator.instance);

    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(3), Composites.EMPTY) }));
    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(4), Composites.EMPTY) }));

    assertSame(map.iterator(), map.iterator(ColumnSlice.ALL_COLUMNS_ARRAY));
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:16,代码来源:ArrayBackedSortedColumnsTest.java


示例19: computeNext

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
protected Cell computeNext()
{
    if (currentSlice == null)
    {
        if (idx >= slices.length)
            return endOfData();

        ColumnSlice slice = slices[idx++];
        // The first idx to include
        int startIdx = slice.start.isEmpty() ? 0 : binarySearch(previousSliceEnd, slice.start);
        if (startIdx < 0)
            startIdx = -startIdx - 1;

        // The first idx to exclude
        int finishIdx = slice.finish.isEmpty() ? cells.size() - 1 : binarySearch(previousSliceEnd, slice.finish);
        if (finishIdx >= 0)
            finishIdx++;
        else
            finishIdx = -finishIdx - 1;

        if (startIdx == 0 && finishIdx == cells.size())
            currentSlice = cells.iterator();
        else
            currentSlice = cells.subList(startIdx, finishIdx).iterator();

        previousSliceEnd = finishIdx > 0 ? finishIdx - 1 : 0;
    }

    if (currentSlice.hasNext())
        return currentSlice.next();

    currentSlice = null;
    return computeNext();
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:35,代码来源:ArrayBackedSortedColumns.java


示例20: testIteratorInternal

import org.apache.cassandra.db.filter.ColumnSlice; //导入依赖的package包/类
private void testIteratorInternal(boolean reversed)
{
    CellNameType type = new SimpleDenseCellNameType(Int32Type.instance);
    ColumnFamily map = ArrayBackedSortedColumns.factory.create(metadata(), reversed);

    int[] values = new int[]{ 1, 2, 3, 5, 9 };

    for (int i = 0; i < values.length; ++i)
        map.addColumn(new Cell(type.makeCellName(values[reversed ? values.length - 1 - i : i])));

    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(3), Composites.EMPTY) }));
    assertSame(new int[]{ 3, 2, 1 }, map.reverseIterator(new ColumnSlice[]{ new ColumnSlice(type.make(4), Composites.EMPTY) }));

    assertSame(map.iterator(), map.iterator(ColumnSlice.ALL_COLUMNS_ARRAY));
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:16,代码来源:ArrayBackedSortedColumnsTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringPath类代码示例发布时间:2022-05-22
下一篇:
Java CachedGauge类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap