Examples of ReadCommand


Examples of com.aerospike.client.command.ReadCommand

   * @param key          unique record identifier
   * @return            whether record exists or not
   * @throws AerospikeException  if command fails
   */
  public final boolean exists(Policy policy, Key key) throws AerospikeException {
    ReadCommand command = new ReadCommand(cluster, key);
    command.setExists(key);
    command.execute(policy);
    return command.getResultCode() == ResultCode.OK;
  }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

  }

  public void run()
  {
    logger_.debug(" Run the consistency checks for " + columnFamily_);   
        ReadCommand readCommandDigestOnly = constructReadMessage(true);
    try
    {
      Message messageDigestOnly = readCommandDigestOnly.makeReadMessage();
      IAsyncCallback digestResponseHandler = new DigestResponseHandler();
      MessagingService.getMessagingInstance().sendRR(messageDigestOnly, replicas_.toArray(new EndPoint[0]), digestResponseHandler);
    }
    catch ( IOException ex )
    {
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

    }
  }
   
    private ReadCommand constructReadMessage(boolean isDigestQuery)
    {
        ReadCommand readCommand = null;
        String table = DatabaseDescriptor.getTables().get(0);
       
        if(columnNames_.size() == 0)
        {
            if( start_ >= 0 && count_ < Integer.MAX_VALUE)
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_, start_, count_);
            }
            else if(sinceTimestamp_ > 0)
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_, sinceTimestamp_);
            }
            else
            {
                readCommand = new ReadCommand(table, row_.key(), columnFamily_);
            }
        }
        else
        {
            readCommand = new ReadCommand(table, row_.key(), columnFamily_, columnNames_);
           
        }
        readCommand.setDigestQuery(isDigestQuery);
        return readCommand;
    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

      IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
            /* Add the local storage endpoint to the replicas_ list */
            replicas_.add(StorageService.getLocalStorageEndPoint());
      IAsyncCallback responseHandler = new DataRepairHandler(ConsistencyManager.this.replicas_.size(), readResponseResolver)
      String table = DatabaseDescriptor.getTables().get(0);
            ReadCommand readCommand = constructReadMessage(false);
      // ReadMessage readMessage = new ReadMessage(table, row_.key(), columnFamily_);
            Message message = readCommand.makeReadMessage();
      MessagingService.getMessagingInstance().sendRR(message, replicas_.toArray( new EndPoint[0] ), responseHandler);     
    }
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        for (String key : keys )
        {
            ReadCommand[] readParameters = new ReadCommand[2];
            if( start >= 0 && count < Integer.MAX_VALUE)
            {
                readParameters[0] = new ReadCommand(tablename, key, columnFamily, start, count);
            }
            else
            {
                readParameters[0] = new ReadCommand(tablename, key, columnFamily);
            }           
            if( start >= 0 && count < Integer.MAX_VALUE)
            {
                readParameters[1] = new ReadCommand(tablename, key, columnFamily, start, count);
            }
            else
            {
                readParameters[1] = new ReadCommand(tablename, key, columnFamily);
            }
            readParameters[1].setDigestQuery(true);
        }       
        rows = doStrongReadProtocol(readMessages);        
        logger_.debug("readProtocol: " + (System.currentTimeMillis() - startTime) + " ms.");
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

     */
    private static Row strongRead(ReadCommand command) throws IOException, TimeoutException
    {
        // TODO: throw a thrift exception if we do not have N nodes

        ReadCommand readMessageDigestOnly = command.copy();
        readMessageDigestOnly.setDigestQuery(true);

        Row row = null;
        Message message = command.makeReadMessage();
        Message messageDigestOnly = readMessageDigestOnly.makeReadMessage();

        IResponseResolver<Row> readResponseResolver = new ReadResponseResolver();
        QuorumResponseHandler<Row> quorumResponseHandler = new QuorumResponseHandler<Row>(
                DatabaseDescriptor.getReplicationFactor(),
                readResponseResolver);
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, columns);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, start, count);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

        Row row = null;
        long startTime = System.currentTimeMillis();
        Map<String, ReadCommand> readMessages = new HashMap<String, ReadCommand>();
        for ( String key : keys )
        {
            ReadCommand readCommand = new ReadCommand(tablename, key, columnFamily, sinceTimestamp);
            readMessages.put(key, readCommand);
        }
        /* Performs the multiget in parallel */
        Map<String, Row> rows = doReadProtocol(readMessages);
        /*
 
View Full Code Here

Examples of org.apache.cassandra.db.ReadCommand

      {
        int key = random.nextInt(keys) + 1;
              String stringKey = new Integer(key).toString();
              stringKey = stringKey + keyFix_ ;
              int j = random.nextInt(columns) + 1;
              ReadCommand rm = new ReadCommand(tablename_, stringKey, columnFamilyColumn_ + ":" + columnFix_ + j);
              readLoad(rm);
        if ( requestsPerSecond_ > 1000)
          Thread.sleep(0, 1000000000/requestsPerSecond_);
        else
          Thread.sleep(1000/requestsPerSecond_);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.