} else {
// get the checksums
// TODO: don't copy data, toBytes does a copy!
List<Checksum> checksums = RSync.checksums(data.toBytes(), blockSize);
AlternativeCompositeByteBuf abuf = AlternativeCompositeByteBuf.compBuffer();
DataBuffer dataBuffer = SyncUtils.encodeChecksum(checksums, entry.getKey().versionKey(), data.hash(), abuf);
retVal.put(entry.getKey(), new Data(dataBuffer));
LOG.debug("sync required hash = {}", data.hash());
}
} else {
if(isSyncFromOldVersion) {
//TODO: the client could send us his history to figure out what the latest version in this history is
Entry<Number640, Data> latest = storageLayer.
get(entry.getKey().minVersionKey(), entry.getKey().maxVersionKey(), 1, false).lastEntry();
// TODO: don't copy data, toBytes does a copy!
List<Checksum> checksums = RSync.checksums(latest.getValue().toBytes(), blockSize);
AlternativeCompositeByteBuf abuf = AlternativeCompositeByteBuf.compBuffer();
DataBuffer dataBuffer = SyncUtils.encodeChecksum(checksums, latest.getKey().versionKey(),
latest.getValue().hash(), abuf);
retVal.put(entry.getKey(), new Data(dataBuffer));
LOG.debug("sync required for version");
} else {
// not found