Package org.apache.cassandra.cql3

Examples of org.apache.cassandra.cql3.ColumnNameBuilder


    {
        RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        ColumnFamily cf = rm.addOrGet(SchemaColumnFamiliesCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        ColumnNameBuilder builder = SchemaColumnFamiliesCf.getCfDef().getColumnNameBuilder();
        builder.add(ByteBufferUtil.bytes(cfName));
        cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp, ldt));

        for (ColumnDefinition cd : column_metadata.values())
            cd.deleteFromSchema(rm, cfName, timestamp);

        for (TriggerDefinition td : triggers.values())
View Full Code Here


        return converted;
    }

    private ByteBuffer makeDroppedColumnName(ByteBuffer column)
    {
        ColumnNameBuilder builder = SchemaColumnFamiliesCf.cqlCfDef.getColumnNameBuilder();
        builder.add(UTF8Type.instance.decompose(cfName));
        builder.add(UTF8Type.instance.decompose("dropped_columns"));
        return builder.add(column).build();
    }
View Full Code Here

    public void deleteFromSchema(RowMutation rm, String cfName, AbstractType<?> comparator, long timestamp)
    {
        ColumnFamily cf = rm.addOrGet(CFMetaData.SchemaColumnsCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        ColumnNameBuilder builder = CFMetaData.SchemaColumnsCf.getCfDef().getColumnNameBuilder();
        // Note: the following is necessary for backward compatibility. For CQL3, comparator will be UTF8 and nameBytes == name
        ByteBuffer nameBytes = ByteBufferUtil.bytes(comparator.getString(name));
        builder.add(ByteBufferUtil.bytes(cfName)).add(nameBytes);
        cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp, ldt));
    }
View Full Code Here

    private ByteBuffer makePrefix(CompositesIndex index, ByteBuffer key, ExtendedFilter filter, boolean isStart)
    {
        if (key.remaining() == 0)
            return ByteBufferUtil.EMPTY_BYTE_BUFFER;

        ColumnNameBuilder builder;
        IDiskAtomFilter columnFilter = filter.columnFilter(key);
        if (columnFilter instanceof SliceQueryFilter)
        {
            SliceQueryFilter sqf = (SliceQueryFilter)columnFilter;
            builder = index.makeIndexColumnNameBuilder(key, isStart ? sqf.start() : sqf.finish());
        }
        else
        {
            builder = index.getIndexComparator().builder().add(key);
        }
        return isStart ? builder.build() : builder.buildAsEndOfRange();
    }
View Full Code Here

        }
    }

    public static ByteBuffer buildName(CFMetaData meta, ByteBuffer... args)
    {
        ColumnNameBuilder builder = meta.getCfDef().getColumnNameBuilder();
        for (ByteBuffer arg : args)
            builder.add(arg);
        return builder.build();
    }
View Full Code Here

    {
        RowMutation rm = new RowMutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        ColumnFamily cf = rm.addOrGet(SchemaColumnFamiliesCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        ColumnNameBuilder builder = SchemaColumnFamiliesCf.getCfDef().getColumnNameBuilder();
        builder.add(ByteBufferUtil.bytes(cfName));
        cf.addAtom(new RangeTombstone(builder.build(), builder.buildAsEndOfRange(), timestamp, ldt));

        for (ColumnDefinition cd : column_metadata.values())
            cd.deleteFromSchema(rm, cfName, getColumnDefinitionComparator(cd), timestamp);

        for (TriggerDefinition td : triggers.values())
View Full Code Here

        return converted;
    }

    private ByteBuffer makeDroppedColumnName(ByteBuffer column)
    {
        ColumnNameBuilder builder = SchemaColumnFamiliesCf.cqlCfDef.getColumnNameBuilder();
        builder.add(UTF8Type.instance.decompose(cfName));
        builder.add(UTF8Type.instance.decompose("dropped_columns"));
        return builder.add(column).build();
    }
View Full Code Here

        }
    }

    public static ByteBuffer buildName(CFMetaData meta, ByteBuffer... args)
    {
        ColumnNameBuilder builder = meta.getCfDef().getColumnNameBuilder();
        for (ByteBuffer arg : args)
            builder.add(arg);
        return builder.build();
    }
View Full Code Here

        return types;
    }

    public ByteBuffer execute(List<ByteBuffer> parameters) throws InvalidRequestException
    {
        ColumnNameBuilder builder = cfDef.getKeyNameBuilder();
        for (ByteBuffer bb : parameters)
            builder.add(bb);
        return partitioner.getTokenFactory().toByteArray(partitioner.getToken(builder.build()));
    }
View Full Code Here

        {
            Set<?> s = validator.compose(params.variables.get(values.bindIndex));
            Iterator<?> iter = s.iterator();
            while (iter.hasNext())
            {
                ColumnNameBuilder b = iter.hasNext() ? builder.copy() : builder;
                ByteBuffer name = b.add(validator.nameComparator().decompose(iter.next())).build();
                cf.addColumn(params.makeColumn(name, ByteBufferUtil.EMPTY_BYTE_BUFFER));
            }
        }
        catch (MarshalException e)
        {
View Full Code Here

TOP

Related Classes of org.apache.cassandra.cql3.ColumnNameBuilder

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.