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

com.ebuddy.cassandra.dao.SuperColumnFamilyOperations 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.Collection;
import java.util.List;
import java.util.Map;

import javax.annotation.Nonnull;

import com.ebuddy.cassandra.BatchContext;
import com.ebuddy.cassandra.dao.mapper.ColumnMapper;
import com.ebuddy.cassandra.dao.mapper.ColumnMapperWithTimestamps;
import com.ebuddy.cassandra.dao.mapper.SuperColumnFamilyRowMapper;
import com.ebuddy.cassandra.dao.mapper.SuperColumnMapper;
import com.ebuddy.cassandra.dao.visitor.ColumnVisitor;

/**
 * Operations for a super column family.
 * @param   the Row Key type.
 * @param  The supercolumn name type.
 * @param   The subcolumn name type.
 * @param   The column value type.

 * @author Eric Zoerner [email protected]
 */
public interface SuperColumnFamilyOperations  {

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

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

    V readColumnValue(K rowKey, SN superColumnName, N columnName);

    Map readColumnsAsMap(K rowKey, SN superColumnName, N... columnNames);

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

     List readColumns(K rowKey, SN superColumnName, ColumnMapper columnMapper);

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

     List readColumnsWithTimestamps(K rowKey,
                                          SN superColumnName,
                                          N start,
                                          N finish,
                                          int count,
                                          boolean reversed,
                                          ColumnMapperWithTimestamps columnMapper);

    void visitColumns(K rowKey,
                         SN superColumnName,
                         N start,
                         N finish,
                         int count,
                         boolean reversed,
                         ColumnVisitor columnVisitor);

    Map> multiGetAsMap(Collection rowKeys, SN superColumnName);

    Map> multiGetColumnsAsMap(Collection rowKeys, SN superColumnName, N... columnNames);

     List multiGetSuperColumn(Collection rowKeys,
                                    SN superColumnName,
                                    SuperColumnMapper superColumnMapper);

     List multiGetAllSuperColumns(Collection rowKeys,
                                        SuperColumnFamilyRowMapper superColumnFamilyRowMapper);

     List multiGetColumns(Collection rowKeys,
                                SN superColumnName,
                                SuperColumnMapper superColumnMapper,
                                N... columnNames);

    Map> readRowAsMap(K key);

     List readRow(K key, SuperColumnMapper superColumnMapper);

    void writeColumns(K rowKey, SN superColumnName, Map columnMap);

    void writeColumns(K rowKey, SN superColumnName, Map columnMap, @Nonnull BatchContext batchContext);

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

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

    void deleteColumns(K rowKey, SN superColumnName, Iterable subcolumnNames);

    void deleteColumns(K rowKey,
                       SN superColumnName,
                       Iterable subcolumnNames,
                       @Nonnull BatchContext batchContext);

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

    /**
     * Remove the named super column as part of a larger transaction.
     *
     * @param rowKey the row key
     * @param superColumnName the name of the super column being removed
     * @param batchContext the transactional context for batch operations.
     */
    void deleteSuperColumn(K rowKey, SN superColumnName, @Nonnull BatchContext batchContext);

    /**
     * Remove the named super column.
     *
     * @param rowKey the row key
     * @param superColumnName the name of the super column being removed
     */
    void deleteSuperColumn(K rowKey, SN superColumnName);

    void removeRow(K rowKey);

    void removeRow(K rowKey, BatchContext batchContext);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy