当前位置: 首页>>代码示例>>Java>>正文


Java ThriftValidation.validateKey方法代码示例

本文整理汇总了Java中org.apache.cassandra.thrift.ThriftValidation.validateKey方法的典型用法代码示例。如果您正苦于以下问题:Java ThriftValidation.validateKey方法的具体用法?Java ThriftValidation.validateKey怎么用?Java ThriftValidation.validateKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.thrift.ThriftValidation的用法示例。


在下文中一共展示了ThriftValidation.validateKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMutations

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
 * Convert statement into a list of mutations to apply on the server
 *
 * @param options value for prepared statement markers
 * @param local if true, any requests (for collections) performed by getMutation should be done locally only.
 * @param now the current timestamp in microseconds to use if no timestamp is user provided.
 *
 * @return list of the mutations
 * @throws InvalidRequestException on invalid requests
 */
private Collection<? extends IMutation> getMutations(QueryOptions options, boolean local, long now)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> keys = buildPartitionKeyNames(options);
    Composite clusteringPrefix = createClusteringPrefix(options);

    UpdateParameters params = makeUpdateParameters(keys, clusteringPrefix, options, local, now);

    Collection<IMutation> mutations = new ArrayList<IMutation>(keys.size());
    for (ByteBuffer key: keys)
    {
        ThriftValidation.validateKey(cfm, key);
        ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cfm);
        addUpdateForKey(cf, key, clusteringPrefix, params);
        Mutation mut = new Mutation(cfm.ksName, key, cf);

        mutations.add(isCounter() ? new CounterMutation(mut, options.getConsistency()) : mut);
    }
    return mutations;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:ModificationStatement.java

示例2: getMutations

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
 * Convert statement into a list of mutations to apply on the server
 *
 * @param variables value for prepared statement markers
 * @param local if true, any requests (for collections) performed by getMutation should be done locally only.
 * @param cl the consistency to use for the potential reads involved in generating the mutations (for lists set/delete operations)
 * @param now the current timestamp in microseconds to use if no timestamp is user provided.
 *
 * @return list of the mutations
 * @throws InvalidRequestException on invalid requests
 */
public Collection<? extends IMutation> getMutations(List<ByteBuffer> variables, boolean local, ConsistencyLevel cl, long now, boolean isBatch)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> keys = buildPartitionKeyNames(variables);
    ColumnNameBuilder clusteringPrefix = createClusteringPrefixBuilder(variables);

    // Some lists operation requires reading
    Map<ByteBuffer, ColumnGroupMap> rows = readRequiredRows(keys, clusteringPrefix, local, cl);
    UpdateParameters params = new UpdateParameters(cfm, variables, getTimestamp(now, variables), getTimeToLive(variables), rows);

    Collection<IMutation> mutations = new ArrayList<IMutation>();
    for (ByteBuffer key: keys)
    {
        ThriftValidation.validateKey(cfm, key);
        ColumnFamily cf = updateForKey(key, clusteringPrefix, params);
        mutations.add(makeMutation(key, cf, cl, isBatch));
    }
    return mutations;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:31,代码来源:ModificationStatement.java

示例3: getMutations

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
 * Convert statement into a list of mutations to apply on the server
 *
 * @param variables value for prepared statement markers
 * @param local if true, any requests (for collections) performed by getMutation should be done locally only.
 * @param cl the consistency to use for the potential reads involved in generating the mutations (for lists set/delete operations)
 * @param now the current timestamp in microseconds to use if no timestamp is user provided.
 *
 * @return list of the mutations
 * @throws InvalidRequestException on invalid requests
 */
public Collection<? extends IMutation> getMutations(List<ByteBuffer> variables, boolean local, ConsistencyLevel cl, long now, boolean isBatch)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> keys = buildPartitionKeyNames(variables);
    Composite clusteringPrefix = createClusteringPrefix(variables);

    // Some lists operation requires reading
    Map<ByteBuffer, CQL3Row> rows = readRequiredRows(keys, clusteringPrefix, local, cl);
    UpdateParameters params = new UpdateParameters(cfm, variables, getTimestamp(now, variables), getTimeToLive(variables), rows);

    Collection<IMutation> mutations = new ArrayList<IMutation>();
    for (ByteBuffer key: keys)
    {
        ThriftValidation.validateKey(cfm, key);
        ColumnFamily cf = updateForKey(key, clusteringPrefix, params);
        mutations.add(makeMutation(key, cf, cl, isBatch));
    }
    return mutations;
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:31,代码来源:ModificationStatement.java

示例4: getMutations

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
/**
 * Convert statement into a list of mutations to apply on the server
 *
 * @param variables value for prepared statement markers
 * @param local if true, any requests (for collections) performed by getMutation should be done locally only.
 * @param cl the consistency to use for the potential reads involved in generating the mutations (for lists set/delete operations)
 * @param now the current timestamp in microseconds to use if no timestamp is user provided.
 *
 * @return list of the mutations
 * @throws InvalidRequestException on invalid requests
 */
private Collection<? extends IMutation> getMutations(List<ByteBuffer> variables, boolean local, ConsistencyLevel cl, long now)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> keys = buildPartitionKeyNames(variables);
    Composite clusteringPrefix = createClusteringPrefix(variables);

    UpdateParameters params = makeUpdateParameters(keys, clusteringPrefix, variables, local, cl, now);

    Collection<IMutation> mutations = new ArrayList<IMutation>();
    for (ByteBuffer key: keys)
    {
        ThriftValidation.validateKey(cfm, key);
        ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cfm);
        addUpdateForKey(cf, key, clusteringPrefix, params);
        Mutation mut = new Mutation(cfm.ksName, key, cf);
        mutations.add(isCounter() ? new CounterMutation(mut, cl) : mut);
    }
    return mutations;
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:31,代码来源:ModificationStatement.java

示例5: executeWithCondition

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public ResultMessage executeWithCondition(QueryState queryState, QueryOptions options)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> variables = options.getValues();
    List<ByteBuffer> keys = buildPartitionKeyNames(variables);
    // We don't support IN for CAS operation so far
    if (keys.size() > 1)
        throw new InvalidRequestException("IN on the partition key is not supported with conditional updates");

    ColumnNameBuilder clusteringPrefix = createClusteringPrefixBuilder(variables);

    ByteBuffer key = keys.get(0);
    ThriftValidation.validateKey(cfm, key);

    UpdateParameters updParams = new UpdateParameters(cfm, variables, queryState.getTimestamp(), getTimeToLive(variables), null);
    ColumnFamily updates = updateForKey(key, clusteringPrefix, updParams);

    // When building the conditions, we should not use the TTL. It's not useful, and if a very low ttl (1 seconds) is used, it's possible
    // for it to expire before actually build the conditions which would break since we would then test for the presence of tombstones.
    UpdateParameters condParams = new UpdateParameters(cfm, variables, queryState.getTimestamp(), 0, null);
    ColumnFamily expected = buildConditions(key, clusteringPrefix, condParams);

    ColumnFamily result = StorageProxy.cas(keyspace(),
                                           columnFamily(),
                                           key,
                                           clusteringPrefix,
                                           expected,
                                           updates,
                                           options.getSerialConsistency(),
                                           options.getConsistency());
    return new ResultMessage.Rows(buildCasResultSet(key, result));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:33,代码来源:ModificationStatement.java

示例6: executeWithCondition

import org.apache.cassandra.thrift.ThriftValidation; //导入方法依赖的package包/类
public ResultMessage executeWithCondition(QueryState queryState, QueryOptions options)
throws RequestExecutionException, RequestValidationException
{
    List<ByteBuffer> variables = options.getValues();
    List<ByteBuffer> keys = buildPartitionKeyNames(variables);
    // We don't support IN for CAS operation so far
    if (keys.size() > 1)
        throw new InvalidRequestException("IN on the partition key is not supported with conditional updates");

    Composite clusteringPrefix = createClusteringPrefix(variables);

    ByteBuffer key = keys.get(0);
    ThriftValidation.validateKey(cfm, key);

    UpdateParameters updParams = new UpdateParameters(cfm, variables, queryState.getTimestamp(), getTimeToLive(variables), null);
    ColumnFamily updates = updateForKey(key, clusteringPrefix, updParams);

    // When building the conditions, we should not use the TTL. It's not useful, and if a very low ttl (1 seconds) is used, it's possible
    // for it to expire before actually build the conditions which would break since we would then test for the presence of tombstones.
    UpdateParameters condParams = new UpdateParameters(cfm, variables, queryState.getTimestamp(), 0, null);
    ColumnFamily expected = buildConditions(key, clusteringPrefix, condParams);

    ColumnFamily result = StorageProxy.cas(keyspace(),
                                           columnFamily(),
                                           key,
                                           clusteringPrefix,
                                           expected,
                                           updates,
                                           options.getSerialConsistency(),
                                           options.getConsistency());
    return new ResultMessage.Rows(buildCasResultSet(key, result));
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:33,代码来源:ModificationStatement.java


注:本文中的org.apache.cassandra.thrift.ThriftValidation.validateKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。