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

com.netflix.astyanax.query.ColumnFamilyQuery 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.query;

import java.util.Collection;

import com.netflix.astyanax.connectionpool.Host;
import com.netflix.astyanax.model.ConsistencyLevel;
import com.netflix.astyanax.retry.RetryPolicy;

/**
 * Top level column family query lets you choose the type of query being
 * performed at the key level. Single key, key range or a key slice.
 * 
 * @author elandau
 * 
 * @param 
 * @param 
 */
public interface ColumnFamilyQuery {
    /**
     * Set the consistency level for this operations.
     * 
     * @param consistencyLevel
     */
    ColumnFamilyQuery setConsistencyLevel(ConsistencyLevel consistencyLevel);

    /**
     * Set the retry policy to use instead of the default
     * 
     * @param consistencyLevel
     */
    ColumnFamilyQuery withRetryPolicy(RetryPolicy retry);

    /**
     * Run the query on the specified host
     * 
     * @param host
     */
    ColumnFamilyQuery pinToHost(Host host);

    /**
     * Query a single key
     * 
     * @param rowKey
     */
    RowQuery getKey(K rowKey);
    
    /**
     * Query a single row
     * 
     * @param rowKey
     */
    RowQuery getRow(K rowKey);

    /**
     * Query a range of keys. startKey and endKey cannot not be used with the
     * RandomPartitioner.
     * 
     * @param startKey
     * @param endKey
     * @param startToken
     * @param endToken
     * @param count
     *            Max number of keys to return
     */
    RowSliceQuery getKeyRange(K startKey, K endKey, String startToken, String endToken, int count);
    
    /**
     * Query a range of rows. startKey and endKey cannot not be used with the
     * RandomPartitioner.
     * 
     * @param startKey
     * @param endKey
     * @param startToken
     * @param endToken
     * @param count
     *            Max number of keys to return
     */
    RowSliceQuery getRowRange(K startKey, K endKey, String startToken, String endToken, int count);

    /**
     * Query a non-contiguous set of keys.
     * 
     * @param keys
     */
    RowSliceQuery getKeySlice(K... keys);
    
    /**
     * Query a non-contiguous set of rows.
     * 
     * @param keys
     */
    RowSliceQuery getRowSlice(K... keys);

    /**
     * Query a non-contiguous set of keys.
     * 
     * @param keys
     */
    RowSliceQuery getKeySlice(Collection keys);

    /**
     * Query a non-contiguous set of rows.
     * 
     * @param keys
     */
    RowSliceQuery getRowSlice(Collection keys);
    
    /**
     * Query a non-contiguous set of keys.
     * 
     * @param keys
     */
    RowSliceQuery getKeySlice(Iterable keys);

    /**
     * Query a non-contiguous set of rows.
     * 
     * @param keys
     */
    RowSliceQuery getRowSlice(Iterable keys);
    
    /**
     * Query to get an iterator to all rows in the column family
     */
    AllRowsQuery getAllRows();

    /**
     * Execute a CQL statement.  Call this for creating a prepared CQL statements.
     * 
     * withCql("...").prepareStatement().execute()
     * 
     * @param cql
     */
    CqlQuery withCql(String cql);
    
    /**
     * Search for keys matching the provided index clause
     * 
     * @param indexClause
     */
    IndexQuery searchWithIndex();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy