ProtocolWaveletDelta delta; try { delta = ProtocolWaveletDelta.parseFrom(deltaBytes); } catch (InvalidProtocolBufferException ex) { throw new InvalidRequestException("Parse delta", operation, ex);
ProtocolWaveletDelta actualDelta = ProtocolWaveletDelta.parseFrom( appliedDelta.getMessage().getSignedOriginalDelta().getDelta()); LOG.info("actual delta: " + actualDelta);
/** * Inspects the given applied delta to determine the {@code HashedVersion} it * was applied at. * This may require looking at the contained {@code ProtocolWaveletDelta}. * * @param appliedDeltaBytes to inspect * @return hashed version the delta was applied at * @throws InvalidProtocolBufferException if the contained * {@code ProtocolWaveletDelta} is invalid * (is only inspected if the applied delta has the hashed version set) */ public static HashedVersion getHashedVersionAppliedAt( ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDeltaBytes) throws InvalidProtocolBufferException { ProtocolAppliedWaveletDelta appliedDelta = appliedDeltaBytes.getMessage(); return CoreWaveletOperationSerializer.deserialize( // If the delta was transformed, the version it was actually applied at is specified // in the top-level message, otherwise we take if from the original signed delta. appliedDelta.hasHashedVersionAppliedAt() ? appliedDelta.getHashedVersionAppliedAt() : ProtocolWaveletDelta.parseFrom(appliedDelta.getSignedOriginalDelta().getDelta()) .getHashedVersion()); }
/** * Parses a {@link ProtocolWaveletDelta}. Convenience method, equivalent to * {@code from(ProtocolWaveletDelta.getDefaultInstanceForType(), byteString)}. */ public static ByteStringMessage<ProtocolWaveletDelta> parseProtocolWaveletDelta( ByteString byteString) throws InvalidProtocolBufferException { return new ByteStringMessage<ProtocolWaveletDelta>( ProtocolWaveletDelta.parseFrom(byteString), byteString); }