Package org.apache.cassandra.db.composites

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


        else
            logger.warn("Unable to find matching endpoint for target {} when storing a hint", targetId);

        UUID hintId = UUIDGen.getTimeUUID();
        // serialize the hint with id and version as a composite column name
        CellName name = CFMetaData.HintsCf.comparator.makeCellName(hintId, MessagingService.current_version);
        ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, Mutation.serializer, MessagingService.current_version));
        ColumnFamily cf = ArrayBackedSortedColumns.factory.create(Schema.instance.getCFMetaData(Keyspace.SYSTEM_KS, SystemKeyspace.HINTS_CF));
        cf.addColumn(name, value, System.currentTimeMillis(), ttl);
        return new Mutation(Keyspace.SYSTEM_KS, UUIDType.instance.decompose(targetId), cf);
    }
View Full Code Here


        }

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

            ByteBuffer key = k.bindAndGet(params.variables);
            ByteBuffer value = t.bindAndGet(params.variables);
            if (key == null)
                throw new InvalidRequestException("Invalid null map key");

            CellName cellName = cf.getComparator().create(prefix, column.name, key);

            if (value == null)
            {
                cf.addColumn(params.makeTombstone(cellName));
            }
View Full Code Here

            assert value instanceof Maps.Value;

            Map<ByteBuffer, ByteBuffer> toAdd = ((Maps.Value)value).map;
            for (Map.Entry<ByteBuffer, ByteBuffer> entry : toAdd.entrySet())
            {
                CellName cellName = cf.getComparator().create(prefix, columnName, entry.getKey());
                cf.addColumn(params.makeColumn(cellName, entry.getValue()));
            }
        }
View Full Code Here

                            catch (InvalidRequestException e)
                            {
                                throw new AssertionError(e);
                            }

                            CellName name = metadata.comparator.cellFromByteBuffer(nameBytes);
                            ColumnDefinition cd = metadata.getColumnDefinition(name);
                            if (cd != null)
                                result.schema.value_types.put(nameBytes, TypeParser.getShortName(cd.type));
                            org.apache.cassandra.db.Cell c = row.cf.getColumn(name);
                            if (c == null || c.isMarkedForDelete(System.currentTimeMillis()))
View Full Code Here

        // (don't need to worry about cfNew containing Columns that are shadowed by
        // the delete tombstone, since cfNew was generated by CF.resolve, which
        // takes care of those for us.)
        for (Cell cellExternal : cfComposite)
        {
            CellName cName = cellExternal.name();
            Cell cellInternal = getColumn(cName);
            if (cellInternal == null)
            {
                cfDiff.addColumn(cellExternal);
            }
View Full Code Here

    @Test
    public void testIndexScan()
    {
        ColumnFamilyStore cfs = Keyspace.open("Keyspace1").getColumnFamilyStore("Indexed1");
        Mutation rm;
        CellName nobirthdate = cellname("notbirthdate");
        CellName birthdate = cellname("birthdate");

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

    @Test
    public void testIndexUpdate() throws IOException
    {
        Keyspace keyspace = Keyspace.open("Keyspace2");
        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Indexed1");
        CellName birthdate = cellname("birthdate");

        // create a row and update the birthdate value, test that the index query fetches the new version
        Mutation rm;
        rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 1);
View Full Code Here

        Keyspace keyspace = Keyspace.open(keySpace);
        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
        cfs.truncateBlocking();

        ByteBuffer rowKey = ByteBufferUtil.bytes("k1");
        CellName colName = cellname("birthdate");
        ByteBuffer val1 = ByteBufferUtil.bytes(1L);
        ByteBuffer val2 = ByteBufferUtil.bytes(2L);

        // create a row and update the "birthdate" value, test that the index query fetches this version
        Mutation rm;
View Full Code Here

        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("v1");
        ByteBuffer val2 = ByteBufferUtil.bytes("v2");

        // create a row and update the author value
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.