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

com.ebuddy.cassandra.dao.ColumnFamilyOperations Maven / Gradle / Ivy

There is a newer version: 2.4.2
Show newest version
/*
 * Copyright 2013 eBuddy B.V.
 *
 *    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.ebuddy.cassandra.dao;

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nonnull;

import com.ebuddy.cassandra.BatchContext;
import com.ebuddy.cassandra.dao.mapper.ColumnFamilyRowMapper;
import com.ebuddy.cassandra.dao.mapper.ColumnMapper;

/**
 * Core Column Family operations.
 * @author Eric Zoerner [email protected]
 */
public interface ColumnFamilyOperations {

    /**
     * Create a BatchContext for use with this keyspace.
     *
     * @return the BatchContext
     */
    BatchContext begin();

    /**
     * Execute a batch of mutations using a mutator.
     *
     * @param batchContext the BatchContext
     */
    void commit(@Nonnull BatchContext batchContext);

    V readColumnValue(K rowKey, N columnName);

    Map readColumnsAsMap(K rowKey);
    Map readColumnsAsMap(K rowKey, N start, N finish, int count, boolean reversed);

     List readColumns(K rowKey, ColumnMapper columnMapper);

     List readColumns(K rowKey, N start, N finish, int count, boolean reversed, ColumnMapper columnMapper);

    Map> multiGetAsMap(Iterable rowKeys);

    Map> multiGetColumnsAsMap(Iterable rowKeys, N... columnNames);

    Map> readRowsAsMap();

     List multiGet(Iterable rowKeys, ColumnFamilyRowMapper rowMapper);

     List multiGetColumns(Iterable rowKeys, ColumnFamilyRowMapper rowMapper, N... columnNames);

    void writeColumn(K rowKey, N columnName, V columnValue);

    void writeColumn(K rowKey, N columnName, V columnValue, long timeToLive, TimeUnit timeToLiveTimeUnit);

    void writeColumn(K rowKey, N columnName, V columnValue, @Nonnull BatchContext batchContext);

    void writeColumn(K rowKey,
                     N columnName,
                     V columnValue,
                     int timeToLive,
                     TimeUnit timeToLiveTimeUnit,
                     @Nonnull BatchContext batchContext);

    void writeColumns(K rowKey, Map map);

    void writeColumns(K rowKey, Map map, @Nonnull BatchContext batchContext);

    void deleteColumns(K rowKey, N... columnNames);

    void deleteColumns(K rowKey, N start, N finish);
    void deleteColumns(K rowKey, N start, N finish, BatchContext batchContext);

    void removeRow(K rowKey);

    void removeRow(K rowKey, BatchContext batchContext);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy