Package com.google.appengine.api.datastore.EntityCachingStrategy

Examples of com.google.appengine.api.datastore.EntityCachingStrategy.PreMutationCachingResult


  public Future<List<Key>> put( Transaction txn, Iterable<Entity> entities) {
    List<Entity> entityList = entities instanceof List
        ? (List<Entity>) entities : Lists.newArrayList(entities);
    PutContext prePutContext = new PutContext(this, entityList);
    datastoreServiceConfig.getDatastoreCallbacks().executePrePutCallbacks(prePutContext);
    PreMutationCachingResult preMutationCachingResult =
        entityCachingStrategy.prePut(this, entityList);

    List<IndexedItem<Key>> indexedKeysToSkip = Lists.newArrayList();
    Set<Key> mutationKeysToSkip = preMutationCachingResult.getMutationKeysToSkip();
    List<Entity> entitiesToPut;
    if (!mutationKeysToSkip.isEmpty()) {
      entitiesToPut = Lists.newArrayList();
      int index = 0;
      for (Entity entity : entityList) {
View Full Code Here


  public Future<Void> delete(Transaction txn, Iterable<Key> keys) {
    List<Key> allKeys = keys instanceof List
        ? (List<Key>) keys : ImmutableList.copyOf(keys);
    DeleteContext preDeleteContext = new DeleteContext(this, allKeys);
    datastoreServiceConfig.getDatastoreCallbacks().executePreDeleteCallbacks(preDeleteContext);
    PreMutationCachingResult preMutationCachingResult =
        entityCachingStrategy.preDelete(this, allKeys);
    Future<Void> result = null;
    Collection<Key> keysToDelete;
    Set<Key> keysToSkip = preMutationCachingResult.getMutationKeysToSkip();
    if (keysToSkip.isEmpty()) {
      keysToDelete = allKeys;
    } else {
      Set<Key> keySet = Sets.newHashSet(allKeys);
      keySet.removeAll(keysToSkip);
View Full Code Here

    ensureTxnStarted();
    try {
      for (Future<?> f : txnStack.getFutures(this)) {
        FutureHelper.quietGet(f);
      }
      PreMutationCachingResult preMutationCachingResult =
          entityCachingStrategy.preCommit(txnStack.getPutEntities(this),
              txnStack.getDeletedKeys(this));
      Future<Void> commitResponse = internalTransaction.doCommitAsync();
      state = TransactionState.COMPLETION_IN_PROGRESS;
      Future<Void> result = new FutureWrapper<Void, Void>(commitResponse) {
View Full Code Here

    ensureTxnStarted();
    try {
      for (Future<?> f : txnStack.getFutures(this)) {
        FutureHelper.quietGet(f);
      }
      PreMutationCachingResult preMutationCachingResult =
          entityCachingStrategy.preCommit(txnStack.getPutEntities(this),
              txnStack.getDeletedKeys(this));
      Future<CommitResponse> commitResponse = makeAsyncCall("Commit", new CommitResponse());
      state = TransactionState.COMPLETION_IN_PROGRESS;
      Future<Void> result = new FutureWrapper<CommitResponse, Void>(commitResponse) {
View Full Code Here

  public Future<List<Key>> put( Transaction txn, Iterable<Entity> entities) {
    List<Entity> entityList = List.class.isAssignableFrom(entities.getClass()) ?
                                    (List<Entity>) entities : Lists.newArrayList(entities);
    PutContext prePutContext = new PutContext(this, entityList);
    getDatastoreServiceConfig().getDatastoreCallbacks().executePrePutCallbacks(prePutContext);
    PreMutationCachingResult preMutationCachingResult =
        getEntityCachingStrategy().prePut(this, entityList);

    List<IndexedItem<Key>> indexedKeysToSkip = Lists.newArrayList();
    List<IndexedItem<Entity>> indexedEntitiesToPut = Lists.newArrayList();
    Set<Key> mutationKeysToSkip = preMutationCachingResult.getMutationKeysToSkip();
    int index = 0;
    for (Entity entity : entityList) {
      if (mutationKeysToSkip.contains(entity.getKey())) {
        indexedKeysToSkip.add(new IndexedItem<Key>(entity.getKey(), index++));
      } else {
View Full Code Here

  public Future<Void> delete(Transaction txn, Iterable<Key> keys) {
    List<Key> allKeys =
        List.class.isAssignableFrom(keys.getClass()) ? (List<Key>) keys : Lists.newArrayList(keys);
    DeleteContext preDeleteContext = new DeleteContext(this, allKeys);
    getDatastoreServiceConfig().getDatastoreCallbacks().executePreDeleteCallbacks(preDeleteContext);
    PreMutationCachingResult preMutationCachingResult =
        getEntityCachingStrategy().preDelete(this, allKeys);
    Future<Void> result = null;
    Iterable<Key> keysToDelete;
    Set<Key> keysToSkip = preMutationCachingResult.getMutationKeysToSkip();
    if (keysToSkip.isEmpty()) {
      keysToDelete = allKeys;
    } else {
      Set<Key> keySet = Sets.newHashSet(allKeys);
      keySet.removeAll(keysToSkip);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.EntityCachingStrategy.PreMutationCachingResult

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.