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


Java ThriftClientState类代码示例

本文整理汇总了Java中org.apache.cassandra.thrift.ThriftClientState的典型用法代码示例。如果您正苦于以下问题:Java ThriftClientState类的具体用法?Java ThriftClientState怎么用?Java ThriftClientState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: prepare

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws RequestValidationException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    if (!postPreparationHooks.isEmpty())
    {
        PreparationContext context = new PreparationContext(clientState, queryString, statement);
        for (PostPreparationHook hook : postPreparationHooks)
            hook.processStatement(statement, context);
    }

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:QueryProcessor.java

示例2: processPrepared

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, new ExecutionContext(clientState, null, variables));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:21,代码来源:QueryProcessor.java

示例3: mutationForKey

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public Mutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    Mutation mutation = new Mutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the partition
        mutation.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        AbstractType<?> at = metadata.comparator.asAbstractType();
        for (Term column : columns)
        {
            CellName columnName = metadata.comparator.cellFromByteBuffer(column.getByteBuffer(at, variables));
            validateColumnName(columnName);
            mutation.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return mutation;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:DeleteStatement.java

示例4: prepare

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:QueryProcessor.java

示例5: processPrepared

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlResult processPrepared(CQLStatement statement, ThriftClientState clientState, List<ByteBuffer> variables)
throws RequestValidationException, RequestExecutionException
{
    // Check to see if there are any bound variables to verify
    if (!(variables.isEmpty() && (statement.boundTerms == 0)))
    {
        if (variables.size() != statement.boundTerms)
            throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables",
                                                            statement.boundTerms,
                                                            variables.size()));

        // at this point there is a match in count between markers and variables that is non-zero

        if (logger.isTraceEnabled())
            for (int i = 0; i < variables.size(); i++)
                logger.trace("[{}] '{}'", i+1, variables.get(i));
    }

    return processStatement(statement, clientState, variables);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:QueryProcessor.java

示例6: prepareRowMutations

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> rowMutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
    {
        rowMutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));
    }

    return rowMutations;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:DeleteStatement.java

示例7: mutationForKey

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    RowMutation rm = new RowMutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    if (columns.size() < 1)
    {
        // No columns, delete the row
        rm.delete(columnFamily, (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        for (Term column : columns)
        {
            ByteBuffer columnName = column.getByteBuffer(metadata.comparator, variables);
            validateColumnName(columnName);
            rm.delete(columnFamily, columnName, (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return rm;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:DeleteStatement.java

示例8: prepare

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlPreparedResult prepare(String queryString, ThriftClientState clientState)
throws InvalidRequestException, SyntaxException
{
    logger.trace("CQL QUERY: {}", queryString);

    CQLStatement statement = getStatement(queryString);
    int statementId = makeStatementId(queryString);
    logger.trace("Discovered "+ statement.boundTerms + " bound variables.");

    clientState.getPrepared().put(statementId, statement);
    logger.trace(String.format("Stored prepared statement #%d with %d bind markers",
                               statementId,
                               statement.boundTerms));

    return new CqlPreparedResult(statementId, statement.boundTerms);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:17,代码来源:QueryProcessor.java

示例9: process

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public static CqlResult process(String queryString, ThriftClientState clientState)
throws RequestValidationException, RequestExecutionException
{
    logger.trace("CQL QUERY: {}", queryString);
    return processStatement(getStatement(queryString),
                            new ExecutionContext(clientState, queryString, Collections.<ByteBuffer>emptyList()));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:QueryProcessor.java

示例10: prepareRowMutations

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> mutations = new LinkedList<>();

    for (Term key: keys)
        mutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));

    return mutations;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:UpdateStatement.java

示例11: getMutations

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public List<IMutation> getMutations(String keyspace, ThriftClientState clientState, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    List<IMutation> batch = new LinkedList<IMutation>();

    for (AbstractModification statement : statements) {
        batch.addAll(statement.prepareRowMutations(keyspace, clientState, timestamp, variables));
    }

    return batch;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:BatchStatement.java

示例12: prepareRowMutations

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);
    AbstractType<?> keyType = Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator();

    List<IMutation> mutations = new ArrayList<IMutation>(keys.size());

    for (Term key : keys)
        mutations.add(mutationForKey(key.getByteBuffer(keyType, variables), keyspace, timestamp, clientState, variables, metadata));

    return mutations;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:DeleteStatement.java

示例13: prepareRowMutations

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
/** {@inheritDoc} */
public List<IMutation> prepareRowMutations(String keyspace, ThriftClientState clientState, Long timestamp, List<ByteBuffer> variables)
throws InvalidRequestException, UnauthorizedException
{
    boolean hasCommutativeOperation = false;

    for (Map.Entry<Term, Operation> column : getColumns().entrySet())
    {
        if (!column.getValue().isUnary())
            hasCommutativeOperation = true;

        if (hasCommutativeOperation && column.getValue().isUnary())
            throw new InvalidRequestException("Mix of commutative and non-commutative operations is not allowed.");
    }

    CFMetaData metadata = validateColumnFamily(keyspace, columnFamily, hasCommutativeOperation);
    if (hasCommutativeOperation)
        getConsistencyLevel().validateCounterForWrite(metadata);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    clientState.hasColumnFamilyAccess(keyspace, columnFamily, Permission.MODIFY);

    List<IMutation> rowMutations = new LinkedList<IMutation>();

    for (Term key: keys)
    {
        rowMutations.add(mutationForKey(keyspace, key.getByteBuffer(getKeyType(keyspace),variables), metadata, timestamp, clientState, variables));
    }

    return rowMutations;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:33,代码来源:UpdateStatement.java

示例14: mutationForKey

import org.apache.cassandra.thrift.ThriftClientState; //导入依赖的package包/类
public RowMutation mutationForKey(ByteBuffer key, String keyspace, Long timestamp, ThriftClientState clientState, List<ByteBuffer> variables, CFMetaData metadata)
throws InvalidRequestException
{
    RowMutation rm = new RowMutation(keyspace, key);

    QueryProcessor.validateKeyAlias(metadata, keyName);

    AbstractType<?> comparator = metadata.getComparatorFor(null);

    if (columns.size() < 1)
    {
        // No columns, delete the row
        rm.delete(new QueryPath(columnFamily), (timestamp == null) ? getTimestamp(clientState) : timestamp);
    }
    else
    {
        // Delete specific columns
        for (Term column : columns)
        {
            ByteBuffer columnName = column.getByteBuffer(comparator, variables);
            validateColumnName(columnName);
            rm.delete(new QueryPath(columnFamily, null, columnName), (timestamp == null) ? getTimestamp(clientState) : timestamp);
        }
    }

    return rm;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:28,代码来源:DeleteStatement.java


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