Package com.google.walkaround.slob.shared

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


  }

  static SlobId parseRootEntityKey(String entityGroupKind, Key key) {
    Preconditions.checkArgument(entityGroupKind.equals(key.getKind()),
        "Key doesn't have kind %s: %s", entityGroupKind, key);
    return new SlobId(key.getName());
  }
View Full Code Here


          DatastoreUtil.getExistingProperty(entity, DELTA_OP_PROPERTY, Text.class).getValue());
    }
  }

  private DeltaEntry parseDelta(Entity entity) {
    SlobId slobId = new SlobId(entity.getKey().getParent().getName());
    long version = versionFromDeltaId(entity.getKey().getId());
    return new DeltaEntry(slobId, version, deltaEntityConverter.convert(entity));
  }
View Full Code Here

    DatastoreUtil.setNonNullUnindexedProperty(out, DELTA_OP_PROPERTY,
        new Text(in.data.getPayload()));
  }

  private static SnapshotEntry parseSnapshot(Entity e) {
    SlobId id = new SlobId(e.getKey().getParent().getName());
    long version = e.getKey().getId();
    return new SnapshotEntry(id, version,
        DatastoreUtil.getExistingProperty(e, SNAPSHOT_DATA_PROPERTY, Text.class).getValue());
  }
View Full Code Here

      }
    } catch (NumberFormatException nfe) {
      throw new BadRequestException(nfe);
    }

    SlobId objectId = session.getObjectId();
    SlobStore store = storeSelector.get(session.getStoreType()).getSlobStore();
    JSONObject result = new JSONObject();
    HistoryResult history = store.loadHistory(objectId, startVersion, endVersion);
    result.put("history", serializeHistory(startVersion, history.getData()));
    result.put("more", history.hasMore());
View Full Code Here

        inlineNocacheJs(), channelApiUrl);
  }

  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    SlobId convObjectId = new SlobId(requireParameter(req, "id"));
    String versionString = optionalParameter(req, "version", null);
    @Nullable Long version = versionString == null ? null : Long.parseLong(versionString);
    @Nullable ClientId clientId = version != null ? null
        : new ClientId(random64.next(
                // TODO(ohler): justify this number
View Full Code Here

      throw new RuntimeException("Bad broadcast data: " + broadcastData, e);
    }
  }

  public ServerMutateResponse mutateObject(ServerMutateRequest req) throws IOException {
    SlobId objectId = new SlobId(req.getSession().getObjectId());
    Preconditions.checkArgument(req.getVersion() >= 0, "Invalid version: %s", req.getVersion());
    Preconditions.checkArgument(!req.getPayload().isEmpty(), "Empty payload list");

    Update update = new Update(objectId,
        new ClientId(req.getSession().getClientId()),
View Full Code Here

    } catch (InvalidSecurityTokenException e) {
      throw new BadRequestException(e);
    }
    String action = requireParameter(req, "action");
    if ("newwave".equals(action)) {
      SlobId newWaveId = waveletCreator.newConvWithGeneratedId(null, null, false);
      // TODO(ohler): Send 303, not 302.  See
      // http://en.wikipedia.org/wiki/Post/Redirect/Get .
      resp.sendRedirect(Searcher.makeWaveLink(newWaveId));
    } else {
      throw new BadRequestException("Unknown action: " + action);
View Full Code Here

    @Inject WaveIndexer indexer;

    void process(final Key key) throws PermanentFailure {
      new RetryHelper().run(new RetryHelper.VoidBody() {
          @Override public void run() throws PermanentFailure, RetryableFailure {
            SlobId objectId = facilities.parseRootEntityKey(key);
            // Update search index
            try {
              indexer.indexConversation(objectId);
            } catch (WaveletLockedException e) {
              log.log(Level.INFO, "Ignoring locked wavelet: " + objectId, e);
View Full Code Here

      history = serializeChanges(historyOps);
    } else {
      history = serializeChanges(
          InitialOps.conversationWaveletOps(participantId, System.currentTimeMillis(), random64));
    }
    SlobId newId;
    try {
      newId = new RetryHelper().run(
          new RetryHelper.Body<SlobId>() {
            @Override public SlobId run() throws RetryableFailure, PermanentFailure {
              SlobId convId = getRandomObjectId();
              CheckedTransaction tx = datastore.beginTransaction();
              try {
                convStore.newObject(tx, convId, makeObsoleteConvMetadata(), history,
                    inhibitPreAndPostCommit);
                convMetadataStore.put(tx, convId,
View Full Code Here

  }

  private SlobId getRandomObjectId() {
    // 96 random bits.  (6 bits per base64 character.)  TODO(ohler): Justify the
    // number 96.
    return new SlobId(random64.next(96 / 6));
  }
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.