All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.astyanax.ColumnListMutation Maven / Gradle / Ivy

There is a newer version: 3.10.2
Show newest version
/*******************************************************************************
 * Copyright 2011 Netflix
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.netflix.astyanax;

import java.nio.ByteBuffer;
import java.util.Date;
import java.util.UUID;

import com.netflix.astyanax.model.ColumnPath;

/**
 * Abstraction for batching column operations on a single row.
 * 
 * @author elandau
 * 
 * @param 
 */
public interface ColumnListMutation {
    /**
     * Generic call to insert a column value with a custom serializer. User this
     * only when you need a custom serializer otherwise use the overloaded
     * putColumn calls to insert common value types.
     * 
     * @param                The value type
     * @param columnName        The column name
     * @param value             The value
     * @param valueSerializer   Serializer used to convert value to internal ByteBuffer
     * @param ttl               Optional TTL, null for none
     */
     ColumnListMutation putColumn(C columnName, V value, Serializer valueSerializer, Integer ttl);
     ColumnListMutation putColumnIfNotNull(C columnName, V value, Serializer valueSerializer, Integer ttl);

    /**
     * @deprecated Super columns are being phased out. Use composite columns
     *             instead.
     */
     ColumnListMutation withSuperColumn(ColumnPath superColumnPath);

    ColumnListMutation putColumn(C columnName, String value, Integer ttl);
    ColumnListMutation putColumn(C columnName, String value);
    ColumnListMutation putColumnIfNotNull(C columnName, String value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, String value);

    ColumnListMutation putCompressedColumn(C columnName, String value, Integer ttl);
    ColumnListMutation putCompressedColumn(C columnName, String value);
    ColumnListMutation putCompressedColumnIfNotNull(C columnName, String value, Integer ttl);
    ColumnListMutation putCompressedColumnIfNotNull(C columnName, String value);
    
    ColumnListMutation putColumn(C columnName, byte[] value, Integer ttl);
    ColumnListMutation putColumn(C columnName, byte[] value);
    ColumnListMutation putColumnIfNotNull(C columnName, byte[] value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, byte[] value);

    ColumnListMutation putColumn(C columnName, byte value, Integer ttl);
    ColumnListMutation putColumn(C columnName, byte value);
    ColumnListMutation putColumnIfNotNull(C columnName, Byte value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Byte value);
    
    ColumnListMutation putColumn(C columnName, short value, Integer ttl);
    ColumnListMutation putColumn(C columnName, short value);
    ColumnListMutation putColumnIfNotNull(C columnName, Short value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Short value);
    
    ColumnListMutation putColumn(C columnName, int value, Integer ttl);
    ColumnListMutation putColumn(C columnName, int value);
    ColumnListMutation putColumnIfNotNull(C columnName, Integer value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Integer value);

    ColumnListMutation putColumn(C columnName, long value, Integer ttl);
    ColumnListMutation putColumn(C columnName, long value);
    ColumnListMutation putColumnIfNotNull(C columnName, Long value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Long value);

    ColumnListMutation putColumn(C columnName, boolean value, Integer ttl);
    ColumnListMutation putColumn(C columnName, boolean value);
    ColumnListMutation putColumnIfNotNull(C columnName, Boolean value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Boolean value);

    ColumnListMutation putColumn(C columnName, ByteBuffer value, Integer ttl);
    ColumnListMutation putColumn(C columnName, ByteBuffer value);
    ColumnListMutation putColumnIfNotNull(C columnName, ByteBuffer value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, ByteBuffer value);

    ColumnListMutation putColumn(C columnName, Date value, Integer ttl);
    ColumnListMutation putColumn(C columnName, Date value);
    ColumnListMutation putColumnIfNotNull(C columnName, Date value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Date value);

    ColumnListMutation putColumn(C columnName, float value, Integer ttl);
    ColumnListMutation putColumn(C columnName, float value);
    ColumnListMutation putColumnIfNotNull(C columnName, Float value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Float value);

    ColumnListMutation putColumn(C columnName, double value, Integer ttl);
    ColumnListMutation putColumn(C columnName, double value);
    ColumnListMutation putColumnIfNotNull(C columnName, Double value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, Double value);

    ColumnListMutation putColumn(C columnName, UUID value, Integer ttl);
    ColumnListMutation putColumn(C columnName, UUID value);
    ColumnListMutation putColumnIfNotNull(C columnName, UUID value, Integer ttl);
    ColumnListMutation putColumnIfNotNull(C columnName, UUID value);

    ColumnListMutation putEmptyColumn(C columnName, Integer ttl);
    ColumnListMutation putEmptyColumn(C columnName);

    ColumnListMutation incrementCounterColumn(C columnName, long amount);

    /**
     * Insert a delete column mutation.  Note that you must be careful when deleting 
     * and adding the same column on the same mutation.  For the most part all columns
     * will have the same timestamp so only the first operation will be performed.
     * @param columnName
     * @return
     */
    ColumnListMutation deleteColumn(C columnName);

    /**
     * The timestamp for all subsequent column operation in this ColumnListMutation
     * This timestamp does not affect the current timestamp for the entire MutationBatch
     * @param timestamp New timestamp in microseconds
     */
    ColumnListMutation setTimestamp(long timestamp);

    /**
     * Deletes all columns at the current column path location. Delete at the
     * root of a row effectively deletes the entire row. This operation also
     * increments the internal timestamp by 1 so new mutations can be added to
     * this row.
     */
    ColumnListMutation delete();

    /**
     * Set the default TTL to use when null is specified to a column insert. The
     * default TTL is null, which means no TTL.
     * 
     * @param ttl  Timeout value in seconds
     */
    ColumnListMutation setDefaultTtl(Integer ttl);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy