Package com.google.walkaround.slob.shared

Examples of com.google.walkaround.slob.shared.SlobId


    log.info("Participants: " + fields.participants.size()
        + ", UDWs: " + participantsToUdws.size());

    for (ParticipantId participant : fields.participants) {
      SlobId udwId = participantsToUdws.get(participant);
      log.info("Indexing " + convId.getId() + " for " + participant.getAddress() +
          (udwId != null ? " with udw " + udwId : " with no udw"));

      Supplement supplement = udwId == null ? null : getSupplement(loadUdw(convId, udwId));
      index(fields, participant, supplement);
View Full Code Here


   */
  public void indexSupplement(SlobId udwId)
      throws PermanentFailure, RetryableFailure, WaveletLockedException {
    log.info("Indexing conversation for participant with udwId " + udwId);
    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();
    }
View Full Code Here

        int unreadBlips = getRequiredIntField(result, UNREAD_BLIP_COUNT_FIELD);
        boolean isUnread = getAtomFields(result, IS_FIELD).contains(IS_UNREAD_ATOM);
        unreadCount = unreadBlips == 0 && !isUnread ? null : unreadBlips;
      }
      entries.add(new UserIndexEntry(
          new SlobId(result.getId()),
          ParticipantId.ofUnsafe(
              HACK ? "hack@hack.com" : getRequiredStringField(result, CREATOR_FIELD)),
          HACK ? "XXX" : getRequiredStringField(result, TITLE_FIELD),
          snippetHtml,
          HACK ? 1L : getRequiredLongField(result, MODIFIED_MINUTES_FIELD)
View Full Code Here

  @Override
  protected RobotNotified parse(Entity e) {
    String[] parts = e.getKey().getName().split(" ", -1);
    Assert.check(parts.length == 2, "Wrong number of spaces in key: %s", e);

    SlobId slobId = new SlobId(parts[0]);
    ParticipantId robotId = ParticipantId.ofUnsafe(parts[1]);

    long version = DatastoreUtil.getExistingProperty(e, VERSION_PROPERTY, Long.class);
    return new RobotNotified(slobId, robotId, version);
  }
View Full Code Here

        public void runAfterCommit(Runnable r) {
          throw new AssertionError("Not implemented");
        }
      };

    SlobId objectId = new SlobId(OBJECT_ID);
    ClientId clientId = new ClientId("s");
    String payload = "{\"a\": 5}";

    // I didn't track down exactly where the 12 comes from.
    int encodingOverhead = 12;
View Full Code Here

  }

  public void testOversizedProperties() throws Exception {
    String massiveString = makeMassiveString();
    final List<String> movedProperties = Lists.newArrayList();
    SlobId objectId = new SlobId(OBJECT_ID);
    CheckedTransaction tx = datastore.beginTransaction();
    MutationLog mutationLog =
        new MutationLog(datastore,
            ROOT_ENTITY_KIND, DELTA_ENTITY_KIND, SNAPSHOT_ENTITY_KIND,
            new MutationLog.DefaultDeltaEntityConverter(),
View Full Code Here

  }

  private WaveletMapping createUdw(SlobId convId) throws IOException {
    long creationTime = System.currentTimeMillis();
    List<WaveletOperation> history = InitialOps.userDataWaveletOps(participantId, creationTime);
    SlobId objectId = newUdwWithGeneratedId(makeObsoleteUdwMetadata(convId),
        serializeChanges(history));
    return registerWavelet(objectId);
  }
View Full Code Here

        serializeChanges(history));
    return registerWavelet(objectId);
  }

  public SlobId getOrCreateUdw(SlobId convId) throws IOException {
    SlobId existing = udwDirectory.getUdwId(convId, userId);
    if (existing != null) {
      return existing;
    } else {
      SlobId newUdwId = createUdw(convId)
          .getObjectId();
      SlobId existingUdwId = udwDirectory.getOrAdd(convId, userId, newUdwId);
      if (existingUdwId == null) {
        return newUdwId;
      } else {
        log.log(Level.WARNING, "Multiple concurrent UDW creations for "
            + userId + " on " + convId + ": " + existingUdwId + ", " + newUdwId);
View Full Code Here

          entity, WAVELET_PRIVATE_LOCAL_ID_PROPERTY, String.class);
      @Nullable String sharedLocalId = DatastoreUtil.getOptionalProperty(
          entity, WAVELET_SHARED_LOCAL_ID_PROPERTY, String.class);
      return new RemoteConvWavelet(instanceAndWaveId.getFirst(), digest,
          instanceAndWaveId.getSecond().waveletId,
          privateLocalId == null ? null : new SlobId(privateLocalId),
          sharedLocalId == null ? null : new SlobId(sharedLocalId));
    } catch (MessageException e) {
      throw new RuntimeException("Failed to parse wave entity: " + entity, e);
    }
  }
View Full Code Here

    }

    @Override protected Entry parse(Entity in) {
      Pair<SourceInstance, WaveletName> id = parseId(in.getKey().getName());
      return new Entry(id.getFirst(), id.getSecond(),
          new SlobId(DatastoreUtil.getExistingProperty(in, SLOB_ID_PROPERTY, String.class)));
    }
View Full Code Here

TOP

Related Classes of com.google.walkaround.slob.shared.SlobId

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.