// We have to stop getting the history at conv version, because we're not
// computing the metadata again for any concurrent ops that got added
// since we loaded the convResult - so we don't want them getting added
// into our diff snapshot. We can let the client catch up instead.
HistoryResult history;
try {
history = convStore.loadHistory(convObjectId, intermediateVersion, convVersion);
} catch (SlobNotFoundException e) {
throw new RuntimeException(
"Conv object disappeared when trying to load history: " + convObjectId);
}
// Graceful degrade to no diff-on-open if there was too much data.
// TODO(danilatos): Potentially try to load more history if there's time,
// or, memcache the current progress so a refresh would have a better
// chance... or implement composition trees... or some other improvement.
if (history.hasMore()) {
return waveWithoutDiffs(convObjectId, convResult, convWavelet, loadedUdw);
}
List<String> mutations = mutations(history.getData());
WaveletDiffSnapshot convSnapshot = serializer.createWaveletDiffMessage(
intermediateWavelet, convWavelet, lastReadVersions, mutations);
return new LoadedWave(convObjectId, convResult, convSnapshot, loadedUdw);
}