Exemplo n.º 1
0
  @Override
  public NavigableSet<ByteStringMessage<ProtocolAppliedWaveletDelta>> requestHistory(
      ProtocolHashedVersion versionStart, ProtocolHashedVersion versionEnd)
      throws WaveletStateException {
    acquireReadLock();
    try {
      assertStateOk();
      // TODO: ### validate requested range.
      // TODO: #### make immutable.

      NavigableSet<ByteStringMessage<ProtocolAppliedWaveletDelta>> set =
          appliedDeltas.subSet(
              appliedDeltas.floor(emptyAppliedDeltaAtVersion(versionStart.getVersion())),
              true,
              emptyAppliedDeltaAtVersion(versionEnd.getVersion()),
              false);
      LOG.info(
          "### HR "
              + versionStart.getVersion()
              + " - "
              + versionEnd.getVersion()
              + " set - "
              + set.size()
              + " = "
              + set);
      return set;
    } finally {
      releaseReadLock();
    }
  }
Exemplo n.º 2
0
 /**
  * Parse to a ProtocolHashedVersion from a given string version/base64-hash combination.
  *
  * @param startVersion the starting version
  * @param base64Hash the base64 hash
  * @throws IllegalArgumentException on bad data
  * @return a parsed protobuf object
  */
 private static ProtocolHashedVersion parseFromUnsafe(String startVersion, String base64Hash)
     throws IllegalArgumentException {
   return ProtocolHashedVersion.newBuilder()
       .setVersion(Long.parseLong(startVersion))
       .setHistoryHash(Base64Util.decode(base64Hash))
       .build();
 }
Exemplo n.º 3
0
 @Override
 public NavigableSet<ProtocolWaveletDelta> requestTransformedHistory(
     ProtocolHashedVersion versionStart, ProtocolHashedVersion versionEnd)
     throws WaveletStateException {
   acquireReadLock();
   try {
     assertStateOk();
     // TODO: ### validate requested range.
     // TODO: #### make immutable.
     return transformedDeltas.subSet(
         transformedDeltas.floor(emptyDeltaAtVersion(versionStart.getVersion())),
         true,
         emptyDeltaAtVersion(versionEnd.getVersion()),
         false);
   } finally {
     releaseReadLock();
   }
 }