Java Code Examples for org.apache.cassandra.transport.messages.ResultMessage#Void

The following examples show how to use org.apache.cassandra.transport.messages.ResultMessage#Void . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryProcessor.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public ResultMessage processStatement(CQLStatement statement, QueryState queryState, QueryOptions options)
throws RequestExecutionException, RequestValidationException
{
    logger.trace("Process {} @CL.{}", statement, options.getConsistency());
    ClientState clientState = queryState.getClientState();
    statement.checkAccess(clientState);
    statement.validate(clientState);

    ResultMessage result = statement.execute(queryState, options);
    return result == null ? new ResultMessage.Void() : result;
}
 
Example 2
Source File: BatchStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
private ResultMessage execute(QueryState queryState, BatchQueryOptions options, boolean local, long now)
throws RequestExecutionException, RequestValidationException
{
    if (options.getConsistency() == null)
        throw new InvalidRequestException("Invalid empty consistency level");
    if (options.getSerialConsistency() == null)
        throw new InvalidRequestException("Invalid empty serial consistency level");

    if (hasConditions)
        return executeWithConditions(options, queryState);

    executeWithoutConditions(getMutations(options, local, now), options.getConsistency());
    return new ResultMessage.Void();
}
 
Example 3
Source File: ListPermissionsStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
private ResultMessage resultMessage(List<PermissionDetails> details)
{
    if (details.isEmpty())
        return new ResultMessage.Void();

    ResultSet result = new ResultSet(metadata);
    for (PermissionDetails pd : details)
    {
        result.addColumnValue(UTF8Type.instance.decompose(pd.username));
        result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString()));
        result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString()));
    }
    return new ResultMessage.Rows(result);
}
 
Example 4
Source File: SchemaAlteringStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public ResultMessage execute(QueryState state, QueryOptions options) throws RequestValidationException
{
    // If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change.  To avoid doing
    // extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600)
    boolean didChangeSchema = announceMigration(false);
    return didChangeSchema ? new ResultMessage.SchemaChange(changeEvent()) : new ResultMessage.Void();
}
 
Example 5
Source File: SchemaAlteringStatement.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
public ResultMessage executeInternal(QueryState state, QueryOptions options)
{
    try
    {
        boolean didChangeSchema = announceMigration(true);
        return didChangeSchema ? new ResultMessage.SchemaChange(changeEvent()) : new ResultMessage.Void();
    }
    catch (RequestValidationException e)
    {
        throw new RuntimeException(e);
    }
}