Examples of HashedVersion


Examples of org.waveprotocol.wave.model.version.HashedVersion

   *
   * @param currentVersion version at which to connect.
   */
  private void checkedConnectChannel(long currentVersion) throws ChannelException {
    byte[] signature = sig(currentVersion);
    final HashedVersion signedVersion = HashedVersion.of(currentVersion, sig(currentVersion));
    final ObservableWaveletData wavelet = buildSnapshot(currentVersion, signature);

    receiver.expectConnection(signedVersion, signedVersion);
    receiver.expectCommit(currentVersion);
    connectChannel(wavelet);
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   * @param committed committed version
   * @param commitSignature committed signature
   */
  private void checkedReconnectChannel(List<TransformedWaveletDelta> list, long committed,
      byte[] commitSignature) throws ChannelException {
    HashedVersion signedVersion = HashedVersion.of(
        list.get(0).getAppliedAtVersion(), list.get(0).getResultingVersion().getHistoryHash());
    receiver.expectConnection(signedVersion, signedVersion);
    receiver.expectCommit(committed);
    reconnectChannel(list, committed, commitSignature);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   * @param delta delta to receive, or null for no delta
   * @param committed last committed version, or -1 to omit
   */
  private void receiveUpdateOnConnectedChannel(TransformedWaveletDelta delta, long committed,
      byte[] commitSignature) throws ChannelException {
    HashedVersion commitVersion = null;
    List<TransformedWaveletDelta> deltas = CollectionUtils.newArrayList();
    if (delta != null) {
      deltas.add(delta);
    }
    if (committed != -1) {
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   *
   * @param version wavelet version
   * @param signature wavelet signature
   */
  private ObservableWaveletData buildSnapshot(final long version, final byte[] signature) {
    HashedVersion hv = HashedVersion.of(version, signature);
    return DATA_FACTORY.create(
        new EmptyWaveletSnapshot(WAVE_ID, WAVELET_ID,
            new ParticipantId("creator@gwave.com"), hv, 0L));
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   * @throws OperationException if the operations can not be rolled back to
   *         create a snapshot before the deltas have been applied.
   */
  public static WaveletAndDeltas create(ReadableWaveletData snapshot, DeltaSequence deltas)
      throws OperationException {
    HashedVersion endVersion = deltas.isEmpty() ? snapshot.getHashedVersion() :
        deltas.getEndVersion();
    Preconditions.checkArgument(snapshot.getVersion() == endVersion.getVersion(),
        String.format("Version of snapshot %s doesn't match the end version %s",
            snapshot.getVersion(), endVersion));

    ObservableWaveletData preDeltaWavelet = WaveletDataUtil.copyWavelet(snapshot);
    rollback(preDeltaWavelet, deltas);
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   * @param newDeltas the deltas that have been applied since the last call to
   *        appendDeltas.
   */
  public void appendDeltas(ReadableWaveletData updatedSnapshot,
      DeltaSequence newDeltas) {
    HashedVersion newEndVersion = newDeltas.getEndVersion();
    Preconditions.checkArgument(
        !newDeltas.isEmpty(), "There were no new deltas passed to appendDeltas");
    Preconditions.checkArgument(updatedSnapshot.getVersion() == newEndVersion.getVersion(),
        String.format("Version of snapshot %s doesn't match the HashedVersion %s",
            updatedSnapshot.getVersion(), newEndVersion));
    Preconditions.checkArgument(areContiguousToCurrentVersion(newDeltas), String.format(
        "Deltas are not contiguous to the current version(%s) %s", getVersionAfterDeltas(), deltas));
    WaveletName updatedWaveletName = WaveletDataUtil.waveletNameOf(updatedSnapshot);
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

   * @param participant the wavelet creator.
   * @param waveletName the wavelet name.
   */
  public static RobotWaveletData createEmptyRobotWavelet(ParticipantId participant,
      WaveletName waveletName) {
    HashedVersion hashedVersionZero = HASH_FACTORY.createVersionZero(waveletName);
    ObservableWaveletData emptyWavelet =
        WaveletDataUtil.createEmptyWavelet(waveletName, participant, hashedVersionZero,
            System.currentTimeMillis());
    RobotWaveletData newWavelet = new RobotWaveletData(emptyWavelet, hashedVersionZero);
    return newWavelet;
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

      Preconditions.illegalArgument("Operation channel already exists for: " + waveletId);
    }

    // Create the new channel, and fake an initial snapshot.
    // TODO(anorth): inject a clock for providing timestamps.
    HashedVersion v0 = hashFactory.createVersionZero(WaveletName.of(waveId, waveletId));
    final ObservableWaveletData emptySnapshot =
        dataFactory.create(
            new EmptyWaveletSnapshot(waveId, waveletId, creator, v0, System.currentTimeMillis()));

    try {
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

                Preconditions.illegalState("Resync wavelet has no stacklet. Channels: "
                    + channels.keySet() + ", resync: " + expectedWavelets.keySet());
              }
              WaveletName wavelet = WaveletName.of(waveId, maybeMissing);
              List<TransformedWaveletDelta> resyncDeltaList = createVersionZeroResync(wavelet);
              HashedVersion v0 = hashFactory.createVersionZero(wavelet);
              stacklet.onWaveletUpdate(resyncDeltaList, v0, v0);
              itr.remove();
            }
          }
View Full Code Here

Examples of org.waveprotocol.wave.model.version.HashedVersion

  // *** Helpers

  private void submitDeltaToNewWavelet(WaveletName name, ParticipantId user,
      WaveletOperation... ops) throws Exception {

    HashedVersion version = V0_HASH_FACTORY.createVersionZero(name);
    WaveletDelta delta = new WaveletDelta(user, version, Arrays.asList(ops));
    addWaveletToUserView(name, user);


    ProtocolWaveletDelta protoDelta = CoreWaveletOperationSerializer.serialize(delta);
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.