예제 #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();
    }
  }
예제 #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();
 }
예제 #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();
   }
 }