Package org.waveprotocol.wave.model.operation.wave

Examples of org.waveprotocol.wave.model.operation.wave.WaveletDelta


      DeltaPair transformedPair = (new DeltaPair(unacknowledged, serverDelta)).transform();
      // The ops of the server delta are transformed, all metadata remains.
      transformedServerDelta = transformedPair.getServer();
      // The unacknowledged delta must have applied after the server delta.
      unacknowledged = new WaveletDelta(unacknowledged.getAuthor(),
          serverDelta.getResultingVersion(), transformedPair.getClient());
    }

    // Transform against any queued ops
    transformedServerDelta = clientOperationQueue.transform(transformedServerDelta);
View Full Code Here


      WaveletOperationContext context = new WaveletOperationContext(
          ParticipantId.ofUnsafe(delta.getAuthor()), Constants.NO_TIMESTAMP, 1);
      ops.add(deserialize(op, context));
    }
    HashedVersion hashedVersion = deserialize(delta.getHashedVersion());
    return new WaveletDelta(new ParticipantId(delta.getAuthor()),
        deserialize(delta.getHashedVersion()), ops);
  }
View Full Code Here

    // Extract the serialised wavelet delta
    ByteStringMessage<ProtocolWaveletDelta> protocolDelta =
        ByteStringMessage.parseProtocolWaveletDelta(
            appliedDelta.getMessage().getSignedOriginalDelta().getDelta());
    WaveletDelta delta = CoreWaveletOperationSerializer.deserialize(protocolDelta.getMessage());

    // Transform operations against earlier deltas, if necessary
    WaveletDelta transformed = maybeTransformSubmittedDelta(delta);
    if (transformed.getTargetVersion().equals(delta.getTargetVersion())) {
      // No transformation took place.
      // As a sanity check, the hash from the applied delta should NOT be set (an optimisation, but
      // part of the protocol).
      if (appliedDelta.getMessage().hasHashedVersionAppliedAt()) {
        LOG.warning("Hashes are the same but applied delta has hashed_version_applied_at");
        // TODO: re-enable this exception for version 0.3 of the spec
//        throw new InvalidHashException("Applied delta and its contained delta have same hash");
      }
    }

    if (transformed.size() == 0) {
      // The host shouldn't be forwarding empty deltas!
      markStateCorrupted();
      throw new WaveServerException("Couldn't apply authoritative delta, " +
          "it transformed away at version " + transformed.getTargetVersion().getVersion());
    }

    if (!transformed.getTargetVersion().equals(hashedVersion)) {
      markStateCorrupted();
      throw new WaveServerException("Couldn't apply authoritative delta, " +
          "it transformed to wrong version. Expected " + hashedVersion +
          ", actual " + transformed.getTargetVersion().getVersion());
    }

    // Apply the delta to the local wavelet state.
    // This shouldn't fail since the delta is from the authoritative server, so if it fails
    // then the wavelet is corrupted (and the caller of this method will sort it out).
View Full Code Here

    // submit with a suspended argument ("thunk", "callback")
    // which is invoked when the RPC request is put on the wire,
    // and let the suspension invoke takeArgs
    // NOTE(anorth): the op channel does not currently take advantage
    // of this anyway.
    final WaveletDelta delta = takeArgs();

    if (delta == null) {
      return; // Transmission has been cancelled.
    }
View Full Code Here

      if (ops.isEmpty()) {
        // No ops to generate delta for
        continue;
      }
      WaveletDelta delta = new WaveletDelta(author, snapshotVersion, ops);
      deltas.add(delta);
    }
    return deltas;
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.operation.wave.WaveletDelta

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.