Package org.apache.cassandra.service

Examples of org.apache.cassandra.service.ClientState


    public List<KeySlice> get_paged_slice(String column_family, KeyRange range, ByteBuffer start_column, ConsistencyLevel consistency_level)
    throws InvalidRequestException, UnavailableException, TimedOutException, TException
    {
        logger.debug("get_paged_slice");

        ClientState cState = state();
        String keyspace = cState.getKeyspace();
        cState.hasColumnFamilyAccess(column_family, Permission.READ);

        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_family);
        ThriftValidation.validateKeyRange(metadata, null, range);
        ThriftValidation.validateConsistencyLevel(keyspace, consistency_level, RequestType.READ);
View Full Code Here


    public List<KeySlice> get_indexed_slices(ColumnParent column_parent, IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException
    {
        logger.debug("scan");

        ClientState cState = state();
        cState.hasColumnFamilyAccess(column_parent.column_family, Permission.READ);
        String keyspace = cState.getKeyspace();
        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_parent.column_family, false);
        ThriftValidation.validateColumnParent(metadata, column_parent);
        ThriftValidation.validatePredicate(metadata, column_parent, column_predicate);
        ThriftValidation.validateIndexClauses(metadata, index_clause);
        ThriftValidation.validateConsistencyLevel(keyspace, consistency_level, RequestType.READ);
View Full Code Here

    public synchronized String system_drop_column_family(String column_family)
    throws InvalidRequestException, SchemaDisagreementException, TException
    {
        logger.debug("drop_column_family");
       
        ClientState cState = state();
        cState.hasColumnFamilySchemaAccess(Permission.WRITE);
        validateSchemaAgreement();
       
        try
        {
            applyMigrationOnStage(new DropColumnFamily(cState.getKeyspace(), column_family));
            return Schema.instance.getVersion().toString();
        }
        catch (ConfigurationException e)
        {
            InvalidRequestException ex = new InvalidRequestException(e.getMessage());
View Full Code Here

            throw new SchemaDisagreementException();
    }

    public void truncate(String cfname) throws InvalidRequestException, UnavailableException, TimedOutException, TException
    {
        ClientState cState = state();
        logger.debug("truncating {} in {}", cfname, cState.getKeyspace());
        cState.hasColumnFamilyAccess(cfname, Permission.WRITE);
        try
        {
            schedule(DatabaseDescriptor.getRpcTimeout());
            try
            {
                StorageProxy.truncateBlocking(cState.getKeyspace(), cfname);
            }
            finally
            {
                release();
            }
View Full Code Here

    public void add(ByteBuffer key, ColumnParent column_parent, CounterColumn column, ConsistencyLevel consistency_level)
            throws InvalidRequestException, UnavailableException, TimedOutException, TException
    {
        logger.debug("add");

        ClientState cState = state();
        cState.hasColumnFamilyAccess(column_parent.column_family, Permission.WRITE);
        String keyspace = cState.getKeyspace();

        CFMetaData metadata = ThriftValidation.validateColumnFamily(keyspace, column_parent.column_family, true);
        ThriftValidation.validateKey(metadata, key);
        ThriftValidation.validateCommutativeForWrite(metadata, consistency_level);
        ThriftValidation.validateColumnParent(metadata, column_parent);
View Full Code Here

       
        String queryString = uncompress(query,compression);
               
        try
        {
            ClientState cState = state();
            if (cState.getCQLVersion().major == 2)
                return QueryProcessor.process(queryString, state());
            else
                return org.apache.cassandra.cql3.QueryProcessor.process(queryString, cState);
        }
        catch (RecognitionException e)
View Full Code Here

               
        String queryString = uncompress(query,compression);
       
        try
        {
            ClientState cState = state();
            if (cState.getCQLVersion().major == 2)
                return QueryProcessor.prepare(queryString, cState);
            else
                return org.apache.cassandra.cql3.QueryProcessor.prepare(queryString, cState);
        }
        catch (RecognitionException e)
View Full Code Here

    public CqlResult execute_prepared_cql_query(int itemId, List<ByteBuffer> bindVariables)
    throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException
    {
        if (logger.isDebugEnabled()) logger.debug("execute_prepared_cql_query");

        ClientState cState = state();
        if (cState.getCQLVersion().major == 2)
        {
            CQLStatement statement = cState.getPrepared().get(itemId);

            if (statement == null)
                throw new InvalidRequestException(String.format("Prepared query with ID %d not found", itemId));
            logger.trace("Retrieved prepared statement #{} with {} bind markers", itemId, statement.boundTerms);

            return QueryProcessor.processPrepared(statement, cState, bindVariables);
        }
        else
        {
            org.apache.cassandra.cql3.CQLStatement statement = cState.getCQL3Prepared().get(itemId);

            if (statement == null)
                throw new InvalidRequestException(String.format("Prepared query with ID %d not found", itemId));
            logger.trace("Retrieved prepared statement #{} with {} bind markers", itemId, statement.getBoundsTerms());
View Full Code Here

    }
   
    public ClientState state()
    {
        SocketAddress remoteSocket = SocketSessionManagementService.remoteSocket.get();
        ClientState retval = null;
        if (null != remoteSocket)
        {
            retval = SocketSessionManagementService.instance.get(remoteSocket);
            if (null == retval)
            {
                retval = new ClientState();
                SocketSessionManagementService.instance.put(remoteSocket, retval);
            }
        }
        else
        {
View Full Code Here

    public ResultMessage execute(ClientState state) throws RequestValidationException, RequestExecutionException
    {
        return QueryProcessor.process(String.format("SELECT * FROM %s.%s", Auth.AUTH_KS, Auth.USERS_CF),
                                      ConsistencyLevel.ONE,
                                      new QueryState(new ClientState(true)));
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.service.ClientState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.