/** * Truncate to the given version. */ public void truncateAt(long version) { HashedVersion signature = getSignatureAt(version); setCurrentSignature(signature); TransformedWaveletDelta currentDelta = getDeltaStartingAt(version); while(currentDelta != null) { removeDelta(currentDelta); currentDelta = getDeltaStartingAt(currentDelta.getResultingVersion().getVersion()); } } }
/** * Reboot the server and make the server wake up with only deltas that end before or at the * given version. * @param version The version the server wakes up to. */ public void reboot(long version) { history.truncateAt(version); }
history.addDelta(serverDelta); history.setCurrentSignature(endVersion);
/** * Reopen a connection to the client. * @param clientConnection * @param clientKnownDeltas * @throws OperationException * @throws TransformException */ public void reOpen(ServerConnectionMock clientConnection, List<HashedVersion> clientKnownDeltas) throws ChannelException, TransformException, OperationException { ReOpenInfo toClient = ccCore.reopen(clientKnownDeltas); // We have none of the client's signature. Then return the most recent. if (toClient == null) { HashedVersion startSignature = history.getCurrentSignature(); clientConnection.triggerOnOpen(startSignature, startSignature); } else { List<TransformedWaveletDelta> deltas = toClient.getDeltas(); HashedVersion startSignature = toClient.getStartSignature(); HashedVersion endSignature = deltas.size() > 0 ? deltas.get(deltas.size() - 1).getResultingVersion() : startSignature; clientConnection.triggerOnOpen(startSignature, endSignature); clientConnection.triggerServerDeltas(deltas); } }
history.addDelta(serverDelta); history.setCurrentSignature(endVersion);
/** * Reopen a connection to the client. * @param clientConnection * @param clientKnownDeltas * @throws OperationException * @throws TransformException */ public void reOpen(ServerConnectionMock clientConnection, List<HashedVersion> clientKnownDeltas) throws ChannelException, TransformException, OperationException { ReOpenInfo toClient = ccCore.reopen(clientKnownDeltas); // We have none of the client's signature. Then return the most recent. if (toClient == null) { HashedVersion startSignature = history.getCurrentSignature(); clientConnection.triggerOnOpen(startSignature, startSignature); } else { List<TransformedWaveletDelta> deltas = toClient.getDeltas(); HashedVersion startSignature = toClient.getStartSignature(); HashedVersion endSignature = deltas.size() > 0 ? deltas.get(deltas.size() - 1).getResultingVersion() : startSignature; clientConnection.triggerOnOpen(startSignature, endSignature); clientConnection.triggerServerDeltas(deltas); } }
/** * Truncate to the given version. */ public void truncateAt(long version) { HashedVersion signature = getSignatureAt(version); setCurrentSignature(signature); TransformedWaveletDelta currentDelta = getDeltaStartingAt(version); while(currentDelta != null) { removeDelta(currentDelta); currentDelta = getDeltaStartingAt(currentDelta.getResultingVersion().getVersion()); } } }
/** * Reboot the server and make the server wake up with only deltas that end before or at the * given version. * @param version The version the server wakes up to. */ public void reboot(long version) { history.truncateAt(version); }