use of com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry in project SilverKing by Morgan-Stanley.
the class SegmentedRetrievalValue method getResult.
private OpResult getResult(DHTKey key) {
MessageGroupRetrievalResponseEntry response;
response = results.get(key);
// System.out.printf("getResult(%s):\t%s\t%s\n", key, response, response == null ? OpResult.INCOMPLETE : response.getOpResult());
return response == null ? OpResult.INCOMPLETE : response.getOpResult();
}
use of com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry in project SilverKing by Morgan-Stanley.
the class SegmentedValue method resultReceived.
@Override
public void resultReceived(DHTKey key, R result) {
R prevResult;
if (debug) {
if (result instanceof MessageGroupRetrievalResponseEntry) {
MessageGroupRetrievalResponseEntry _result;
_result = (MessageGroupRetrievalResponseEntry) result;
System.out.printf("SegmentedValue.resultReceived key: %s\tresult: %s\tvalue %s\n", key, result, ((MessageGroupRetrievalResponseEntry) result).getValue());
} else {
System.out.printf("SegmentedValue.resultReceived key: %s\tresult: %s\tresultsReceived %d\n", key, result, resultsReceived.get());
}
}
prevResult = results.put(key, result);
if (prevResult != null) {
// FIXME
} else {
resultsReceived.incrementAndGet();
}
if (resultsReceived.get() >= keys.length + trackRelayKeyCompletion) {
// all keys + relay key
checkForCompletion();
}
}
use of com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry in project SilverKing by Morgan-Stanley.
the class ConvergenceController2 method incomingSyncRetrievalResponse.
// ////////////////////////////////////////////////////////////////////
// Handle incoming convergence data
public void incomingSyncRetrievalResponse(MessageGroup message) {
List<StorageValueAndParameters> svpList;
SyncRetrievalRequest srr;
srr = outstandingSyncRetrievalRequests.get(message.getUUID());
outstandingMessages.decrementAndGet();
if (outstandingMessages.get() < 0) {
outstandingMessages.set(0);
}
if (debug) {
Log.warningAsyncf("incomingSyncRetrievalResponse");
}
svpList = new ArrayList<>();
for (MessageGroupRetrievalResponseEntry entry : message.getRetrievalResponseValueKeyIterator()) {
StorageValueAndParameters svp;
if (srr != null) {
srr.outstandingKeys.remove(entry);
}
svp = StorageValueAndParameters.createSVP(entry);
if (svp != null) {
svpList.add(svp);
}
}
if (!svpList.isEmpty()) {
// FUTURE - support migration of user data
nsStore.put(svpList, emptyUserData, this);
}
if (srr != null && srr.outstandingKeys.isEmpty()) {
outstandingSyncRetrievalRequests.remove(message.getUUID());
}
checkQueuedChecksumTreeRequests();
checkMGQueue();
checkForCompletion();
}
use of com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry in project SilverKing by Morgan-Stanley.
the class ActiveRegionSync method incomingSyncRetrievalResponse.
// //////////////////////////////////////////////////////////////////
public void incomingSyncRetrievalResponse(MessageGroup message) {
List<StorageValueAndParameters> svpList;
SyncRetrievalRequest srr;
lastUpdateMillis = SystemTimeSource.instance.absTimeMillis();
srr = outstandingSyncRetrievalRequests.get(message.getUUID());
if (debug) {
Log.warning("incomingSyncRetrievalResponse");
}
svpList = new ArrayList<>();
for (MessageGroupRetrievalResponseEntry entry : message.getRetrievalResponseValueKeyIterator()) {
StorageValueAndParameters svp;
if (debug) {
Log.warningf("%s", entry.toString());
}
if (srr != null) {
srr.outstandingKeys.remove(entry);
}
svp = StorageValueAndParameters.createSVP(entry);
if (svp != null) {
svpList.add(svp);
}
}
if (!svpList.isEmpty()) {
if (nsStore != null) {
// FUTURE - support migration of user data
nsStore.put(svpList, emptyUserData, this);
}
}
if (srr != null && srr.outstandingKeys.isEmpty()) {
Log.warningAsyncf("ars %s complete-srr %s", uuid, srr.getUUID());
outstandingSyncRetrievalRequests.remove(srr.getUUID());
inprocessSyncRetrievalRequests.remove(srr.getUUID());
}
// checkMGQueue();
checkForCompletion();
}
use of com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry in project SilverKing by Morgan-Stanley.
the class ActiveProxyRetrieval method handleRetrievalResponse.
// ///////////////////
// Handle responses
public OpResult handleRetrievalResponse(MessageGroup message, MessageGroupConnectionProxy connection) {
RetrievalCommunicator rComm;
Map<IPAndPort, List<DHTKey>> destEntryMap;
OpResult opResult;
rComm = new RetrievalCommunicator();
if (debug) {
System.out.println("handleRetrievalResponse");
}
for (MessageGroupRetrievalResponseEntry entry : message.getRetrievalResponseValueKeyIterator()) {
IPAndPort replica;
replica = new IPAndPort(message.getOriginator(), DHTNode.getServerPort());
if (debug) {
System.out.println("replica: " + replica);
}
retrievalOperation.update(entry, replica, new RetrievalResult(entry, entry.getOpResult(), entry.getValue()), rComm);
}
sendResults(rComm);
destEntryMap = rComm.takeReplicaMessageLists();
if (destEntryMap != null) {
forwardGroupedEntries(destEntryMap, optionsByteBuffer, new RetrievalForwardCreator(), rComm);
}
if (retrievalOptions.getRetrievalOptions().getUpdateSecondariesOnMiss()) {
if (debug) {
Log.warning("ActiveProxyRetrieval calling sendSecondaryReplicasUpdates");
}
sendSecondaryReplicasUpdates(rComm);
} else {
if (debug) {
Log.warning("ActiveProxyRetrieval *no* sendSecondaryReplicasUpdates");
}
}
return retrievalOperation.getOpResult();
}
Aggregations