Package com.google.storage.onestore.v3.OnestoreEntity

Examples of com.google.storage.onestore.v3.OnestoreEntity.EntityProto


            List<Key> deleteList =
                (List<Key>) entity.getProperty(DELETE_LIST_PROPERTY);
            List<Entity> putEntities = new ArrayList<Entity>();
            if (putList != null) {
                for (Blob blob : putList) {
                    EntityProto proto = putReq.addEntity();
                    proto.mergeFrom(blob.getBytes());
                    putEntities.add(EntityTranslator.createFromPb(proto));
                }
            }
            if (putEntities.size() > 0) {
                DatastoreUtil.put(ds, null, putEntities);
View Full Code Here


        List<Blob> putList = new ArrayList<Blob>();
        List<Key> deleteList = new ArrayList<Key>();
        for (Key key : journalMap.keySet()) {
            Entity targetEntity = journalMap.get(key);
            boolean put = targetEntity != null;
            EntityProto targetProto =
                put ? EntityTranslator.convertToPb(targetEntity) : null;
            int size = put ? targetProto.encodingSize() : 0;
            if (totalSize != 0
                && totalSize + size + DatastoreUtil.EXTRA_SIZE > DatastoreUtil.MAX_ENTITY_SIZE) {
                entity.setUnindexedProperty(PUT_LIST_PROPERTY, putList);
                entity.setUnindexedProperty(DELETE_LIST_PROPERTY, deleteList);
                DatastoreUtil.put(ds, null, entity);
                entities.add(entity);
                entity = createEntity(ds, globalTransactionKey);
                putList = new ArrayList<Blob>();
                deleteList = new ArrayList<Key>();
                totalSize = 0;
            }
            if (put) {
                byte[] content = new byte[targetProto.encodingSize()];
                targetProto.outputTo(content, 0);
                putList.add(new Blob(content));
            } else {
                deleteList.add(key);
            }
            totalSize += size + DatastoreUtil.EXTRA_SIZE;
View Full Code Here

            throws NullPointerException {
        if (entity == null) {
            throw new NullPointerException(
                "The entity parameter must not be null.");
        }
        EntityProto pb = EntityTranslator.convertToPb(entity);
        byte[] buf = new byte[pb.encodingSize()];
        pb.outputTo(buf, 0);
        return buf;
    }
View Full Code Here

            throws NullPointerException {
        if (bytes == null) {
            throw new NullPointerException(
                "The bytes parameter must not be null.");
        }
        EntityProto pb = new EntityProto();
        pb.mergeFrom(bytes);
        return EntityTranslator.createFromPb(pb);
    }
View Full Code Here

            throws NullPointerException {
        if (entity == null) {
            throw new NullPointerException(
                "The entity parameter must not be null.");
        }
        EntityProto pb = EntityTranslator.convertToPb(entity);
        byte[] buf = new byte[pb.encodingSize()];
        pb.outputTo(buf, 0);
        return buf;
    }
View Full Code Here

            throws NullPointerException {
        if (bytes == null) {
            throw new NullPointerException(
                "The bytes parameter must not be null.");
        }
        EntityProto pb = new EntityProto();
        pb.mergeFrom(bytes);
        return EntityTranslator.createFromPb(pb);
    }
View Full Code Here

    } else {

      Schema schema = DatastoreUtil.getSchema();
      List<EntityProto> entityProtoList = schema.kinds();
      EntityProto targetEntity = null;
      for (EntityProto entityProto : entityProtoList) {
        String kindName = DatastoreUtil.getKind(entityProto.getKey());
        if (kind.equals(kindName)) {
          targetEntity = entityProto;
          break;
        }
      }
      if (targetEntity == null) {
        throw new RuntimeException("The specified kind has no property");
      }
      List<Property> propertys = targetEntity.propertys();
      for (Property property : propertys) {
        GbProperty gbProperty = new GbProperty();
        gbProperty.setName(property.getName());
        list.add(gbProperty);
      }
View Full Code Here

  private Map<Key, Entity> extractCache(PutRequest requestPb, PutResponse responsePb) {
    Map<Key, Entity> newMap = new HashMap<Key, Entity>();
    int size = requestPb.entitySize();
    List<EntityProto> entitys = requestPb.entitys();
    for (int i = 0; i < size; i++) {
      EntityProto proto = entitys.get(i);
      Reference reference = responsePb.getKey(i);
      Key key = PbKeyUtil.toKey(reference);
      Entity entity = new Entity();
      entity.setEntity(proto);
      entity.setKey(reference);
View Full Code Here

    responsePb.clearResult();

    for (Key key : keys) {
      Entity entityByGet = (batchGet == null) ? null : batchGet.get(key);
      if (entityByGet != null) {
        EntityProto proto = EntityTranslatorPublic.convertToPb(entityByGet);
        responsePb.addResult(proto);
      } else {
        DatastorePb.GetResponse.Entity entity = cached.get(key);
        if (entity != null) {
          responsePb.addResult(entity.getEntity());
View Full Code Here

        QueryResult result = new QueryResult();
        result.mergeFrom(response);
        logger.debug("QueryResult:hasMoreResults:" + result.hasMoreResults());
        logger.debug("QueryResult:isMoreResults:" + result.isMoreResults());
        //logger.debug(result.toString());
        EntityProto proto = result.getResult(0);
        if (proto != null) {
            String kind = getKindFromKey(proto.getKey());
            logger.debug("Kind of Next response: " + kind);
        }
       
        // キャッシュに登録 (Nextがあるときは登録しない)
        //if (! result.isMoreResults()) {
View Full Code Here

TOP

Related Classes of com.google.storage.onestore.v3.OnestoreEntity.EntityProto

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.