Examples of ProtocolHashedVersion


Examples of org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion

      }

      // Optionally submit any received last committed notice.
      Element commitNoticeElement = waveletUpdate.element("commit-notice");
      if (commitNoticeElement != null) {
        ProtocolHashedVersion version = ProtocolHashedVersion.newBuilder()
            .setHistoryHash(Base64Util.decode(commitNoticeElement.attributeValue("history-hash")))
            .setVersion(Long.parseLong(commitNoticeElement.attributeValue("version"))).build();
        callbackCount.incrementAndGet(); // Increment required callbacks.
        listener.waveletCommitUpdate(waveletName, version, callback);
      }
View Full Code Here

Examples of org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion

      }
    } else {
      listener.onFailure(FederationErrors.badRequest("Bad response packet: " + historyResponse));
    }

    final ProtocolHashedVersion lastCommitted;
    if (lastCommittedVersion > -1) {
      // TODO(thorogood): fedone doesn't send a history hash, and it's arguable
      // that it's even sane to include it.
      // Can't set it to null - NPE
      lastCommitted =
View Full Code Here

Examples of org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion

      }
    }

    Set<String> remoteDomainsToNotify = Sets.difference(domainsToNotify, localDomains);
    if (!remoteDomainsToNotify.isEmpty()) {
      ProtocolHashedVersion serializedVersion = CoreWaveletOperationSerializer.serialize(version);
      for (String domain : remoteDomainsToNotify) {
        federationHosts.get(domain).waveletCommitUpdate(
            waveletName, serializedVersion, federationCallback("commit notice"));
      }
    }
View Full Code Here

Examples of org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion

            || historyDelta.attribute("wavelet-name") == null) {
      responseCallback.error(FederationErrors.badRequest("Malformed history request"));
      return;
    }

    final ProtocolHashedVersion startVersion;
    try {
      startVersion = parseFromUnsafe(historyDelta.attributeValue("start-version"),
          historyDelta.attributeValue("start-version-hash"));
    } catch (IllegalArgumentException e) {
      responseCallback.error(FederationErrors.badRequest("Invalid format of start version"));
      return;
    }

    final ProtocolHashedVersion endVersion;
    try {
      endVersion = parseFromUnsafe(historyDelta.attributeValue("end-version"),
          historyDelta.attributeValue("end-version-hash"));
    } catch (IllegalArgumentException e) {
      responseCallback.error(FederationErrors.badRequest("Invalid format of end version"));
View Full Code Here

Examples of org.waveprotocol.wave.federation.Proto.ProtocolHashedVersion

    } catch (IllegalArgumentException e) {
      responseCallback.error(FederationErrors.badRequest("Malformed signer ID"));
      return;
    }

    final ProtocolHashedVersion deltaEndVersion;
    try {
      deltaEndVersion = parseFromUnsafe(signerRequest.attributeValue("version"),
          signerRequest.attributeValue("history-hash"));
    } catch (IllegalArgumentException e) {
      responseCallback.error(FederationErrors.badRequest("Invalid hashed version"));
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolHashedVersion

    if (deltas == null) {
      return null;
    } else {
      List<TransformedWaveletDelta> parsed = new ArrayList<TransformedWaveletDelta>();
      for (int i = 0; i < deltas.size(); i++) {
        ProtocolHashedVersion thisEnd = //
            i < deltas.size() - 1 ? deltas.get(i + 1).getHashedVersion() : end;
        parsed.add(deserialize(deltas.get(i), thisEnd));
      }
      return parsed;
    }
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolHashedVersion

  /**
   * Serializes a {@link HashedVersion} POJO to a {@link ProtocolHashedVersion}.
   */
  public static ProtocolHashedVersion serialize(HashedVersion hashedVersion) {
    Blob b64Hash = new Blob(Codec.encode(hashedVersion.getHistoryHash()));
    ProtocolHashedVersion version = ProtocolHashedVersionJsoImpl.create();
    version.setVersion(hashedVersion.getVersion());
    version.setHistoryHash(b64Hash);
    return version;
  }
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolHashedVersion

    /**
     * Records a signed server version.
     */
    void updateHistory(WaveletName wavelet, ProtocolHashedVersion update) {
      ProtocolHashedVersion current = versions.get(wavelet);
      if (current != null && current.getVersion() > update.getVersion()) {
        LOG.info("Ignoring superceded hash update: " + update);
        return;
      }
      versions.put(wavelet, update);
    }
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolHashedVersion

     */
    ProtocolHashedVersion getServerVersion(WaveletName wavelet, WaveletDelta delta) {
      if (delta.getTargetVersion().getVersion() == 0) {
        return serialize(HASHER.createVersionZero(wavelet));
      } else {
        ProtocolHashedVersion current = versions.get(wavelet);
        Preconditions.checkNotNull(current);
        double prevVersion = current.getVersion();
        double deltaVersion = delta.getTargetVersion().getVersion();
        if (deltaVersion != prevVersion) {
          throw new IllegalArgumentException(
              "Client delta expressed against non-server version.  Server version: " + prevVersion
                  + ", client delta: " + deltaVersion);
View Full Code Here

Examples of org.waveprotocol.wave.federation.ProtocolHashedVersion

    /**
     * Records a signed server version.
     */
    void updateHistory(WaveletName wavelet, ProtocolHashedVersion update) {
      ProtocolHashedVersion current = versions.get(wavelet);
      if (current != null && current.getVersion() > update.getVersion()) {
        LOG.info("Ignoring superceded hash update: " + update);
        return;
      }
      versions.put(wavelet, update);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.