use of com.ms.silverking.cloud.dht.common.RawRetrievalResult in project SilverKing by Morgan-Stanley.
the class ConvergenceController2 method incomingSyncRetrievalResponse.
// Currently unused
private void incomingSyncRetrievalResponse(MessageGroupRetrievalResponseEntry entry) {
try {
RawRetrievalResult rawRetrievalResult;
if (entry.getValue() == null) {
Log.warning("Couldn't find value for: ", entry);
return;
} else {
if (debug) {
System.out.printf("Found %s\n", entry);
}
}
rawRetrievalResult = new RawRetrievalResult(RetrievalType.VALUE_AND_META_DATA);
rawRetrievalResult.setStoredValue(entry.getValue(), true, false, null);
StorageValueAndParameters valueAndParameters;
ByteBuffer rawValueBuffer;
ByteBuffer valueBuffer;
// valueBuffer = (ByteBuffer)entry.getValue().duplicate().limit(rawRetrievalResult.getStoredLength());
rawValueBuffer = entry.getValue();
if (debug && true) {
System.out.printf("key %s buf %s storedLength %d uncompressedLength %d compressedLength %d\n", entry, rawValueBuffer, rawRetrievalResult.getStoredLength(), rawRetrievalResult.getUncompressedLength(), MetaDataUtil.getCompressedLength(rawValueBuffer, 0));
System.out.printf("rawValueBuffer %s\n", StringUtil.byteBufferToHexString(rawValueBuffer));
}
valueBuffer = (ByteBuffer) rawValueBuffer.duplicate().position(rawValueBuffer.position() + MetaDataUtil.getDataOffset(rawValueBuffer, 0));
// FUTURE - consider making the nsstore allow a put that just accepts the buffer as is
// to improve performance
valueAndParameters = new StorageValueAndParameters(entry, valueBuffer, rawRetrievalResult.getVersion(), rawRetrievalResult.getUncompressedLength(), MetaDataUtil.getCompressedLength(rawValueBuffer, 0), rawRetrievalResult.getCCSS(), rawRetrievalResult.getChecksum(), rawRetrievalResult.getCreator().getBytes(), rawRetrievalResult.getCreationTimeRaw());
nsStore.put(ImmutableList.of(valueAndParameters), emptyUserData, this);
// FUTURE - preserve user data
} catch (CorruptValueException cve) {
Log.logErrorWarning(cve);
// FUTURE - let this replica know that it's bad
}
}
Aggregations