Package com.google.apphosting.api.DatastorePb

Examples of com.google.apphosting.api.DatastorePb.GetRequest


   *
   * @return A {@link Future} that provides the results of the operation.
   */
  private Future<Map<Key, Entity>> doBatchGetBySize( Transaction txn,
      final Iterable<Key> keys, final Map<Key, Entity> resultMap) {
    GetRequest baseReq = new GetRequest();
    if (txn != null) {
      TransactionImpl.ensureTxnActive(txn);
      baseReq.setTransaction(localTxnToRemoteTxn(txn));
    }
    if (getDatastoreServiceConfig().getReadPolicy().getConsistency() == EVENTUAL) {
      baseReq.setFailoverMs(ARBITRARY_FAILOVER_READ_MS);
      baseReq.setStrong(false);
    }
    final int baseEncodedReqSize = baseReq.encodingSize();

    final List<Future<GetResponse>> futures = new ArrayList<Future<GetResponse>>();
    GetRequest req = baseReq.clone();
    int encodedReqSize = baseEncodedReqSize;
    for (Key key : keys) {
      if (!key.isComplete()) {
        throw new IllegalArgumentException(key + " is incomplete.");
      }
      Reference ref = KeyTranslator.convertToPb(key);

      int encodedKeySize = Protocol.stringSize(ref.encodingSize()) + 1;
      if (getDatastoreServiceConfig().exceedsReadLimits(
          req.keySize() + 1, encodedReqSize + encodedKeySize)) {
        futures.add(makeAsyncCall(apiConfig, "Get", req, new GetResponse()));
        encodedReqSize = baseEncodedReqSize;
        req = baseReq.clone();
      }

      encodedReqSize += encodedKeySize;
      req.addKey(ref);
    }

    if (req.keySize() > 0) {
      futures.add(makeAsyncCall(apiConfig, "Get", req, new GetResponse()));
    }

    return registerInTransaction(txn,
        new IteratingAggregateFuture<GetResponse, Key, Map<Key, Entity>>(futures) {
View Full Code Here


    } else if ("datastore_v3".equals(service) && "Put".equals(method)) {
      PutRequest requestPb = new PutRequest();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Put(requestPb);
    } else if ("datastore_v3".equals(service) && "Get".equals(method)) {
      GetRequest requestPb = new GetRequest();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Get(requestPb);
    } else if ("datastore_v3".equals(service) && "Delete".equals(method)) {
      DeleteRequest requestPb = new DeleteRequest();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Delete(requestPb);
    } else if ("datastore_v3".equals(service) && "RunQuery".equals(method)) {
      Query requestPb = new Query();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_RunQuery(requestPb);
    } else if ("datastore_v3".equals(service) && "Next".equals(method)) {
      NextRequest requestPb = new NextRequest();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Next(requestPb);
    } else if ("datastore_v3".equals(service) && "Commit".equals(method)) {
      Transaction requestPb = new Transaction();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Commit(requestPb);
    } else if ("datastore_v3".equals(service) && "Rollback".equals(method)) {
      Transaction requestPb = new Transaction();
      requestPb.mergeFrom(request);
      return pre_datastore_v3_Rollback(requestPb);
    } else if ("memcache".equals(service) && "Set".equals(method)) {
      try {
        MemcacheSetRequest requestPb = MemcacheSetRequest.parseFrom(request);
        return pre_memcache_Set(requestPb);
View Full Code Here

      requestPb.mergeFrom(request);
      PutResponse responsePb = new PutResponse();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Put(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "Get".equals(method)) {
      GetRequest requestPb = new GetRequest();
      requestPb.mergeFrom(request);
      GetResponse responsePb = new GetResponse();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Get(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "Delete".equals(method)) {
      DeleteRequest requestPb = new DeleteRequest();
      requestPb.mergeFrom(request);
      DeleteResponse responsePb = new DeleteResponse();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Delete(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "RunQuery".equals(method)) {
      Query requestPb = new Query();
      requestPb.mergeFrom(request);
      QueryResult responsePb = new QueryResult();
      responsePb.mergeFrom(response);
      return post_datastore_v3_RunQuery(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "Next".equals(method)) {
      NextRequest requestPb = new NextRequest();
      requestPb.mergeFrom(request);
      QueryResult responsePb = new QueryResult();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Next(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "Commit".equals(method)) {
      Transaction requestPb = new Transaction();
      requestPb.mergeFrom(request);
      CommitResponse responsePb = new CommitResponse();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Commit(requestPb, responsePb);
    } else if ("datastore_v3".equals(service) && "Rollback".equals(method)) {
      Transaction requestPb = new Transaction();
      requestPb.mergeFrom(request);
      CommitResponse responsePb = new CommitResponse();
      responsePb.mergeFrom(response);
      return post_datastore_v3_Rollback(requestPb, responsePb);
    } else if ("memcache".equals(service) && "Set".equals(method)) {
      try {
View Full Code Here

TOP

Related Classes of com.google.apphosting.api.DatastorePb.GetRequest

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.