@Override public HashedVersion getHashedVersion(long version) { final Entry<HashedVersion, WaveletDeltaRecord> cachedEntry = lookupCached(cachedDeltas, version); if (version == 0) { return versionZero; } else if (snapshot == null) { return null; } else if (version == snapshot.getVersion()) { return snapshot.getHashedVersion(); } else { WaveletDeltaRecord delta; try { delta = lookup(version); } catch (IOException e) { throw new RuntimeIOException(new IOException(format("Version : %d", version), e)); } if (delta == null && cachedEntry != null) { return cachedEntry.getKey(); } else { return delta != null ? delta.getAppliedAtVersion() : null; } } }
@Override public TransformedWaveletDelta getTransformedDelta( final HashedVersion beginVersion) { WaveletDeltaRecord delta = cachedDeltas.get(beginVersion); if (delta != null) { return delta.getTransformedDelta(); } else { WaveletDeltaRecord nowDelta; try { nowDelta = lookup(beginVersion.getVersion()); } catch (IOException e) { throw new RuntimeIOException(new IOException(format("Begin version : %s", beginVersion.toString()), e)); } return nowDelta != null ? nowDelta.getTransformedDelta() : null; } }
@Override public ByteStringMessage<ProtocolAppliedWaveletDelta> getAppliedDelta( HashedVersion beginVersion) { WaveletDeltaRecord delta = cachedDeltas.get(beginVersion); if (delta != null) { return delta.getAppliedDelta(); } else { WaveletDeltaRecord record = null; try { record = lookup(beginVersion.getVersion()); } catch (IOException e) { throw new RuntimeIOException(new IOException(format("Begin version : %s", beginVersion.toString()), e)); } return record != null ? record.getAppliedDelta() : null; } }