Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.Mutation


     *
     * @return Mutation to use to completely remove cf from schema
     */
    public Mutation dropFromSchema(long timestamp)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        ColumnFamily cf = mutation.addOrGet(SchemaColumnFamiliesCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        Composite prefix = SchemaColumnFamiliesCf.comparator.make(cfName);
        cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt));

        for (ColumnDefinition cd : allColumns())
            cd.deleteFromSchema(mutation, timestamp);

        for (TriggerDefinition td : triggers.values())
            td.deleteFromSchema(mutation, cfName, timestamp);

        for (String indexName : Keyspace.open(this.ksName).getColumnFamilyStore(this.cfName).getBuiltIndexes())
        {
            ColumnFamily indexCf = mutation.addOrGet(IndexCf);
            indexCf.addTombstone(indexCf.getComparator().makeCellName(indexName), ldt, timestamp);
        }

        return mutation;
    }
View Full Code Here


     *
     * @throws ConfigurationException if any of the attributes didn't pass validation
     */
    public Mutation toSchema(long timestamp) throws ConfigurationException
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        toSchema(mutation, timestamp);
        return mutation;
    }
View Full Code Here

    }

    public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
    throws InvalidRequestException
    {
        Mutation mutation = new Mutation(keyspace, key);

        QueryProcessor.validateKeyAlias(metadata, keyName);

        if (columns.size() < 1)
        {
            // No columns, delete the partition
            mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
        else
        {
            // Delete specific columns
            AbstractType<?> at = metadata.comparator.asAbstractType();
            for (Term column : columns)
            {
                CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
                validateColumnName(columnName);
                mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
            }
        }

        return mutation;
    }
View Full Code Here

     *
     * @return Difference between attributes in form of schema mutation
     */
    public Mutation toSchemaUpdate(CFMetaData newState, long modificationTimestamp, boolean fromThrift)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));

        newState.toSchemaNoColumnsNoTriggers(mutation, modificationTimestamp);

        MapDifference<ByteBuffer, ColumnDefinition> columnDiff = Maps.difference(columnMetadata, newState.columnMetadata);

View Full Code Here

     *
     * @return Mutation to use to completely remove cf from schema
     */
    public Mutation dropFromSchema(long timestamp)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        ColumnFamily cf = mutation.addOrGet(SchemaColumnFamiliesCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        Composite prefix = SchemaColumnFamiliesCf.comparator.make(cfName);
        cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt));

        for (ColumnDefinition cd : allColumns())
            cd.deleteFromSchema(mutation, timestamp);

        for (TriggerDefinition td : triggers.values())
            td.deleteFromSchema(mutation, cfName, timestamp);

        for (String indexName : Keyspace.open(this.ksName).getColumnFamilyStore(this.cfName).getBuiltIndexes())
        {
            ColumnFamily indexCf = mutation.addOrGet(IndexCf);
            indexCf.addTombstone(indexCf.getComparator().makeCellName(indexName), ldt, timestamp);
        }

        return mutation;
    }
View Full Code Here

     *
     * @throws ConfigurationException if any of the attributes didn't pass validation
     */
    public Mutation toSchema(long timestamp) throws ConfigurationException
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        toSchema(mutation, timestamp);
        return mutation;
    }
View Full Code Here

     *
     * @return Difference between attributes in form of schema mutation
     */
    public Mutation toSchemaUpdate(CFMetaData newState, long modificationTimestamp, boolean fromThrift)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));

        newState.toSchemaNoColumnsNoTriggers(mutation, modificationTimestamp);

        MapDifference<ByteBuffer, ColumnDefinition> columnDiff = Maps.difference(columnMetadata, newState.columnMetadata);

View Full Code Here

     *
     * @return Mutation to use to completely remove cf from schema
     */
    public Mutation dropFromSchema(long timestamp)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        ColumnFamily cf = mutation.addOrGet(SchemaColumnFamiliesCf);
        int ldt = (int) (System.currentTimeMillis() / 1000);

        Composite prefix = SchemaColumnFamiliesCf.comparator.make(cfName);
        cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt));

        for (ColumnDefinition cd : allColumns())
            cd.deleteFromSchema(mutation, timestamp);

        for (TriggerDefinition td : triggers.values())
            td.deleteFromSchema(mutation, cfName, timestamp);

        for (String indexName : Keyspace.open(this.ksName).getColumnFamilyStore(this.cfName).getBuiltIndexes())
        {
            ColumnFamily indexCf = mutation.addOrGet(IndexCf);
            indexCf.addTombstone(indexCf.getComparator().makeCellName(indexName), ldt, timestamp);
        }

        return mutation;
    }
View Full Code Here

     *
     * @throws ConfigurationException if any of the attributes didn't pass validation
     */
    public Mutation toSchema(long timestamp) throws ConfigurationException
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));
        toSchema(mutation, timestamp);
        return mutation;
    }
View Full Code Here

     *
     * @return Difference between attributes in form of schema mutation
     */
    public Mutation toSchemaUpdate(CFMetaData newState, long modificationTimestamp, boolean fromThrift)
    {
        Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, SystemKeyspace.getSchemaKSKey(ksName));

        newState.toSchemaNoColumnsNoTriggers(mutation, modificationTimestamp);

        MapDifference<ByteBuffer, ColumnDefinition> columnDiff = Maps.difference(columnMetadata, newState.columnMetadata);

View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.Mutation

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.