Package org.waveprotocol.box.server.waveserver

Examples of org.waveprotocol.box.server.waveserver.WaveletDeltaRecord


    return (delta != null) ? delta.getAppliedAtVersion() : null;
  }

  @Override
  public HashedVersion getResultingVersion(long version) {
    WaveletDeltaRecord delta = getDelta(version);
    return (delta != null) ? delta.getTransformedDelta().getResultingVersion() : null;
  }
View Full Code Here


    return (delta != null) ? delta.getTransformedDelta().getResultingVersion() : null;
  }

  @Override
  public ByteStringMessage<ProtocolAppliedWaveletDelta> getAppliedDelta(long version) {
    WaveletDeltaRecord delta = getDelta(version);
    return (delta != null) ? delta.getAppliedDelta() : null;
  }
View Full Code Here

    return (delta != null) ? delta.getAppliedDelta() : null;
  }

  @Override
  public TransformedWaveletDelta getTransformedDelta(long version) {
    WaveletDeltaRecord delta = getDelta(version);
    return (delta != null) ? delta.getTransformedDelta() : null;
  }
View Full Code Here

  public void append(Collection<WaveletDeltaRecord> deltas) throws PersistenceException {
    checkIsOpen();
    try {
      file.seek(file.length());

      WaveletDeltaRecord lastDelta = null;
      for (WaveletDeltaRecord delta : deltas) {
        index.addDelta(delta.getTransformedDelta().getAppliedAtVersion(),
            delta.getTransformedDelta().size(),
            file.getFilePointer());
        writeDelta(delta);
        lastDelta = delta;
      }

      // fsync() before returning.
      file.getChannel().force(true);
      endVersion = lastDelta.getTransformedDelta().getResultingVersion();
    } catch (IOException e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

    ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDelta =
        readAppliedDelta(header.appliedDeltaLength);
    TransformedWaveletDelta transformedDelta = readTransformedWaveletDelta(
        header.transformedDeltaLength);

    return new WaveletDeltaRecord(AppliedDeltaUtil.getHashedVersionAppliedAt(appliedDelta),
        appliedDelta, transformedDelta);
  }
View Full Code Here

  }

  public static WaveletDeltaRecord deserializeWaveletDeltaRecord(DBObject dbObject)
      throws PersistenceException {
    try {
      return new WaveletDeltaRecord(
          deserializeHashedVersion((DBObject) dbObject.get(FIELD_APPLIEDATVERSION)),
          ByteStringMessage.parseProtocolAppliedWaveletDelta(ByteString.copyFrom((byte[]) dbObject
              .get(FIELD_APPLIED))),
          deserializeTransformedWaveletDelta((DBObject) dbObject.get(FIELD_TRANSFORMED)));
View Full Code Here

          HashedVersion deltaResultingVersion = sourceDeltas.getEndVersion();

          // Deltas
          while (deltaResultingVersion != null && deltaResultingVersion.getVersion() != 0) {
            deltasCount++;
            WaveletDeltaRecord deltaRecord =
                sourceDeltas.getDeltaByEndVersion(deltaResultingVersion.getVersion());
            deltas.add(deltaRecord);
            // get the previous delta, this is the appliedAt
            deltaResultingVersion = deltaRecord.getAppliedAtVersion();
          }
          LOG.info("Appending " + deltasCount + "deltas to target");
          targetDeltas.append(deltas);
        }
      } // While Waves
View Full Code Here

  public void append(Collection<WaveletDeltaRecord> deltas) throws PersistenceException {
    checkIsOpen();
    try {
      file.seek(file.length());

      WaveletDeltaRecord lastDelta = null;
      for (WaveletDeltaRecord delta : deltas) {
        index.addDelta(delta.transformed.getAppliedAtVersion(), delta.transformed.size(),
            file.getFilePointer());
        writeDelta(delta);
        lastDelta = delta;
View Full Code Here

    ByteStringMessage<ProtocolAppliedWaveletDelta> appliedDelta =
        readAppliedDelta(header.appliedDeltaLength);
    TransformedWaveletDelta transformedDelta = readTransformedWaveletDelta(
        header.transformedDeltaLength);

    return new WaveletDeltaRecord(AppliedDeltaUtil.getHashedVersionAppliedAt(appliedDelta),
        appliedDelta, transformedDelta);
  }
View Full Code Here

    return endDeltas.get(version);
  }

  @Override
  public HashedVersion getAppliedAtVersion(long version) throws InvalidProtocolBufferException {
    WaveletDeltaRecord delta = getDelta(version);
    return (delta != null) ? delta.getAppliedAtVersion() : null;
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.server.waveserver.WaveletDeltaRecord

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.