Package org.apache.cassandra.db.composites

Examples of org.apache.cassandra.db.composites.CellName


        ByteBuffer rowKey = ByteBufferUtil.bytes("k1");
        ByteBuffer clusterKey = ByteBufferUtil.bytes("ck1");
        ByteBuffer colName = ByteBufferUtil.bytes("col1");

        CellNameType baseComparator = cfs.getComparator();
        CellName compositeName = baseComparator.makeCellName(clusterKey, colName);

        ByteBuffer val1 = ByteBufferUtil.bytes("v2");

        // Insert indexed value.
        Mutation rm;
View Full Code Here


    public void testIndexScanWithLimitOne()
    {
        ColumnFamilyStore cfs = Keyspace.open("Keyspace1").getColumnFamilyStore("Indexed1");
        Mutation rm;

        CellName nobirthdate = cellname("notbirthdate");
        CellName birthdate = cellname("birthdate");

        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk1"));
        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(1L), 0);
        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
        rm.apply();
View Full Code Here

        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfname);

        // insert two columns that represent the same integer but have different binary forms (the
        // second one is padded with extra zeros)
        Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
        CellName column1 = cellname(ByteBuffer.wrap(new byte[]{1}));
        rm.add(cfname, column1, ByteBufferUtil.bytes("data1"), 1);
        rm.apply();
        cfs.forceBlockingFlush();

        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
        CellName column2 = cellname(ByteBuffer.wrap(new byte[]{0, 0, 1}));
        rm.add(cfname, column2, ByteBufferUtil.bytes("data2"), 2);
        rm.apply();
        cfs.forceBlockingFlush();

        // fetch by the first column name; we should get the second version of the column value
View Full Code Here

    public void testSliceByNamesCommandOldMetatada() throws Throwable
    {
        String keyspaceName = "Keyspace1";
        String cfName= "Standard1";
        DecoratedKey key = Util.dk("slice-name-old-metadata");
        CellName cname = cellname("c1");
        Keyspace keyspace = Keyspace.open(keyspaceName);
        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
        cfs.clearUnsafe();

        // Create a cell a 'high timestamp'
View Full Code Here

        }

        public void execute(ByteBuffer rowKey, ColumnFamily cf, Composite prefix, UpdateParameters params) throws InvalidRequestException
        {
            // delete + add
            CellName name = cf.getComparator().create(prefix, column);
            cf.addAtom(params.makeTombstoneForOverwrite(name.slice()));
            Adder.doAdd(t, cf, prefix, column, params);
        }
View Full Code Here

            assert value instanceof Sets.Value : value;

            Set<ByteBuffer> toAdd = ((Sets.Value)value).elements;
            for (ByteBuffer bb : toAdd)
            {
                CellName cellName = cf.getComparator().create(prefix, column, bb);
                cf.addColumn(params.makeColumn(cellName, ByteBufferUtil.EMPTY_BYTE_BUFFER));
            }
        }
View Full Code Here

    public boolean isFullyCoveredBy(ColumnFamily cf, long now)
    {
        // cf will cover all the requested columns if the range it covers include
        // all said columns
        CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();
        CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();

        return cf.getComparator().compare(first, columns.first()) <= 0
            && cf.getComparator().compare(columns.last(), last) <= 0;
    }
View Full Code Here

            protected RangeTombstone computeNext()
            {
                while (names.hasNext())
                {
                    CellName next = names.next();
                    if (lastFindRange != null && lastFindRange.includes(source.getComparator(), next))
                        return lastFindRange;

                    // We keep the last range around as since names are in sort order, it's
                    // possible it will match the next name too.
View Full Code Here

        protected OnDiskAtom computeNext()
        {
            while (iter.hasNext())
            {
                CellName current = iter.next();
                Cell cell = cf.getColumn(current);
                if (cell != null)
                    return cell;
            }
            return endOfData();
View Full Code Here

            return false;

        Composite low = isReversed() ? finish() : start();
        Composite high = isReversed() ? start() : finish();

        CellName first = cf.iterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();
        CellName last = cf.reverseIterator(ColumnSlice.ALL_COLUMNS_ARRAY).next().name();

        return cf.getComparator().compare(first, low) <= 0
            && cf.getComparator().compare(high, last) <= 0;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.composites.CellName

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.