Package org.apache.cassandra.db.filter

Examples of org.apache.cassandra.db.filter.ColumnCounter


        // Redoing the counting like that is not extremely efficient, but
        // discardLast is only called in case of a race between paging and
        // a deletion, which is pretty unlikely, so probably not a big deal
        int liveCount = columnCounter().countAll(cf).live();

        ColumnCounter counter = columnCounter();
        DeletionInfo.InOrderTester tester = cf.inOrderDeletionTester();
        // Discard the first live
        for (Column c : cf)
        {
            counter.count(c, tester);
            if (counter.live() < liveCount)
                copy.addColumn(c);
        }
        return copy;
    }
View Full Code Here


             : discardTail(cf, toDiscard, newCf, cf.iterator(), tester);
    }

    private int discardHead(ColumnFamily cf, int toDiscard, ColumnFamily copy, Iterator<Column> iter, DeletionInfo.InOrderTester tester)
    {
        ColumnCounter counter = columnCounter();

        // Discard the first 'toDiscard' live
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > toDiscard)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
        }
        return Math.min(counter.live(), toDiscard);
    }
View Full Code Here

        // Redoing the counting like that is not extremely efficient.
        // This is called only for reversed slices or in the case of a race between
        // paging and a deletion (pretty unlikely), so this is probably acceptable.
        int liveCount = columnCounter().countAll(cf).live();

        ColumnCounter counter = columnCounter();
        // Discard the last 'toDiscard' live (so stop adding as sound as we're past 'liveCount - toDiscard')
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > liveCount - toDiscard)
                break;

            copy.addColumn(c);
        }
        return Math.min(liveCount, toDiscard);
View Full Code Here

                                 long now) throws RequestValidationException, RequestExecutionException
    {
        SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
        final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);

        ColumnCounter counter = filter.columnCounter(Schema.instance.getComparator(keyspace, columnFamily), now);
        while (!pager.isExhausted())
        {
            List<Row> next = pager.fetchPage(pageSize);
            if (!next.isEmpty())
                counter.countAll(next.get(0).cf);
        }
        return counter.live();
    }
View Full Code Here

        }

        @Override
        public ColumnCounter columnCounter()
        {
            return new ColumnCounter(0);
        }
View Full Code Here

                                 long now) throws RequestValidationException, RequestExecutionException
    {
        SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
        final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);

        ColumnCounter counter = filter.columnCounter(Schema.instance.getComparator(keyspace, columnFamily), now);
        while (!pager.isExhausted())
        {
            List<Row> next = pager.fetchPage(pageSize);
            if (!next.isEmpty())
                counter.countAll(next.get(0).cf);
        }
        return counter.live();
    }
View Full Code Here

    }

    private ColumnFamily discardFirst(ColumnFamily cf)
    {
        ColumnFamily copy = cf.cloneMeShallow();
        ColumnCounter counter = columnCounter();

        Iterator<Column> iter = cf.iterator();
        DeletionInfo.InOrderTester tester = cf.inOrderDeletionTester();
        // Discard the first live
        while (iter.hasNext())
        {
            Column c = iter.next();
            counter.count(c, tester);
            if (counter.live() > 1)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
View Full Code Here

        // Redoing the counting like that is not extremely efficient, but
        // discardLast is only called in case of a race between paging and
        // a deletion, which is pretty unlikely, so probably not a big deal
        int liveCount = columnCounter().countAll(cf).live();

        ColumnCounter counter = columnCounter();
        DeletionInfo.InOrderTester tester = cf.inOrderDeletionTester();
        // Discard the first live
        for (Column c : cf)
        {
            counter.count(c, tester);
            if (counter.live() < liveCount)
                copy.addColumn(c);
        }
        return copy;
    }
View Full Code Here

        }

        @Override
        public ColumnCounter columnCounter()
        {
            return new ColumnCounter(0);
        }
View Full Code Here

             : discardTail(cf, toDiscard, newCf, cf.iterator(), tester);
    }

    private int discardHead(ColumnFamily cf, int toDiscard, ColumnFamily copy, Iterator<Cell> iter, DeletionInfo.InOrderTester tester)
    {
        ColumnCounter counter = columnCounter();

        // Discard the first 'toDiscard' live
        while (iter.hasNext())
        {
            Cell c = iter.next();
            counter.count(c, tester);
            if (counter.live() > toDiscard)
            {
                copy.addColumn(c);
                while (iter.hasNext())
                    copy.addColumn(iter.next());
            }
        }
        return Math.min(counter.live(), toDiscard);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.filter.ColumnCounter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.