Package com.google.walkaround.slob.server

Examples of com.google.walkaround.slob.server.MutationLog


    StateAndVersion raw;
    SlobId convId;
    StableUserId udwOwner;
    CheckedTransaction tx = datastore.beginTransaction();
    try {
      MutationLog l = udwStore.create(tx, udwId);
      ObsoleteWaveletMetadataGsonImpl metadata;
      String metadataString = l.getMetadata();
      try {
        metadata = GsonProto.fromGson(new ObsoleteWaveletMetadataGsonImpl(), metadataString);
      } catch (MessageException e) {
        throw new RuntimeException("Failed to parse obsolete metadata: " + metadataString);
      }
      Assert.check(metadata.hasUdwMetadata(), "Metadata not udw: %s, %s", udwId, metadataString);
      convId = new SlobId(metadata.getUdwMetadata().getAssociatedConvId());
      udwOwner = new StableUserId(metadata.getUdwMetadata().getOwner());
      raw = l.reconstruct(null);
    } finally {
      tx.rollback();
    }
    WaveletName waveletName = IdHack.udwWaveletNameFromConvObjectIdAndUdwObjectId(convId, udwId);
    // TODO(ohler): avoid serialization/deserialization here
View Full Code Here


      ConvMetadata metadata = convMetadataStore.get(tx, id);
      if (metadata.hasImportMetadata()
          && !metadata.getImportMetadata().getImportFinished()) {
        throw new WaveletLockedException("Conv " + id + " locked: " + metadata);
      }
      MutationLog l = convStore.create(tx, id);
      raw = l.reconstruct(null);
    } finally {
      tx.rollback();
    }
    WaveletName waveletName = IdHack.convWaveletNameFromConvObjectId(id);
    // TODO(ohler): avoid serialization/deserialization here
View Full Code Here

  private WaveletDataImpl loadUdw(SlobId convId, SlobId udwId)
      throws PermanentFailure, RetryableFailure {
    StateAndVersion raw;
    CheckedTransaction tx = datastore.beginTransaction();
    try {
      MutationLog l = udwStore.create(tx, udwId);
      raw = l.reconstruct(null);
    } finally {
      tx.rollback();
    }
    WaveletName waveletName = IdHack.udwWaveletNameFromConvObjectIdAndUdwObjectId(convId, udwId);
    // TODO(ohler): avoid serialization/deserialization here
View Full Code Here

                    && !metadata.getImportMetadata().getImportFinished()) {
                  log.info(slobId + " still importing; " + participantId + " may not access");
                  return new Permissions(false, false);
                }
                // Can't use SlobStore here, that would be a cyclic dependency.
                MutationLog mutationLog = convSlobFacilities.getMutationLogFactory()
                    .create(tx, slobId);
                StateAndVersion stateAndVersion = mutationLog.reconstruct(null);
                if (stateAndVersion.getVersion() == 0) {
                  log.info(slobId + " does not exist; " + participantId + " may not access");
                  return new Permissions(false, false);
                }
                // TODO(ohler): introduce generics to avoid the cast.
View Full Code Here

                ConvMetadata metadata = convMetadataStore.get(tx, convId);
                Assert.check(metadata.hasImportMetadata(), "%s: Metadata has no import: %s",
                    convId, metadata);
                Assert.check(metadata.getImportMetadata().getImportFinished(),
                    "%s: still importing: %s", convId, metadata);
                MutationLog l = convSlobFacilities.getMutationLogFactory().create(tx, convId);
                StateAndVersion stateAndVersion = l.reconstruct(null);
                Assert.check(stateAndVersion.getVersion() > 0, "%s at version 0: %s",
                    convId, stateAndVersion);
                // TODO(ohler): use generics to avoid the cast
                ReadableWaveletObject state = (ReadableWaveletObject) stateAndVersion.getState();
                if (state.getParticipants().contains(importingUser)) {
                  log.info(importingUser + " is a participant at version "
                      + stateAndVersion.getVersion());
                  return;
                }
                WaveletOperation op =
                    HistorySynthesizer.newAddParticipant(importingUser.getAddress(),
                        // We preserve last modified time to avoid re-ordering people's inboxes
                        // just because another participant imported.
                        state.getLastModifiedMillis(),
                        importingUser.getAddress());
                log.info(importingUser + " is not a participant at version "
                    + stateAndVersion.getVersion() + ", adding " + op);
                MutationLog.Appender appender = l.prepareAppender().getAppender();
                try {
                  appender.append(
                      new ChangeData<String>(getFakeClientId(), SERIALIZER.serializeDelta(op)));
                } catch (ChangeRejected e) {
                  throw new RuntimeException("Appender rejected AddParticipant: " + op);
View Full Code Here

        @Nullable ChangeRejected rejected = new RetryHelper().run(
            new RetryHelper.Body<ChangeRejected>() {
              @Override public ChangeRejected run() throws RetryableFailure, PermanentFailure {
                CheckedTransaction tx = datastore.beginTransaction();
                try {
                  MutationLog mutationLog = convSlobFacilities.getMutationLogFactory().create(
                      tx, slobId);
                  MutationLog.Appender appender = mutationLog.prepareAppender().getAppender();
                  try {
                    appender.appendAll(buffer);
                  } catch (ChangeRejected e) {
                    return e;
                  }
View Full Code Here

    if (!id.isEmpty()) {
      try {
        SlobId objectId = new SlobId(id);
        CheckedTransaction tx = datastore.beginTransaction();
        try {
          MutationLog mutationLog = storeSelector.get(storeType).getMutationLogFactory()
              .create(tx, objectId);
          objectVersion = mutationLog.getVersion();
          if (!historyStart.isEmpty()) {
            long start = Long.parseLong(historyStart);
            DeltaIterator it = mutationLog.forwardHistory(start,
                historyEnd.isEmpty() ? start + 1000 : Long.parseLong(historyEnd));
            for (long version = start; it.hasNext(); version++) {
              items.add(Pair.of(version, "" + it.next()));
            }
          }
          if (!snapshotVersion.isEmpty()) {
            snapshot = mutationLog.reconstruct(Long.parseLong(snapshotVersion))
                .getState().snapshot();
          }
        } finally {
          tx.rollback();
        }
View Full Code Here

TOP

Related Classes of com.google.walkaround.slob.server.MutationLog

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.