Search in sources :

Example 1 with ProtoMessageGroup

use of com.ms.silverking.cloud.dht.net.ProtoMessageGroup in project SilverKing by Morgan-Stanley.

the class ActiveProxyRetrieval method sendSecondaryReplicasUpdate.

private void sendSecondaryReplicasUpdate(SecondaryReplicasUpdate secondaryReplicasUpdate) {
    RetrievalResult result;
    result = secondaryReplicasUpdate.getResult();
    for (IPAndPort replica : secondaryReplicasUpdate.getReplicas()) {
        ProtoMessageGroup pmg;
        if (debug) {
            Log.warning("ActiveProxyRetrieval sending secondary replicas update to ", replica);
        }
        // pmg = createPutForSecondaryReplicas(result);
        pmg = createValueMessageForSecondaryReplicas(result);
        messageModule.getMessageGroupBase().send(pmg.toMessageGroup(), replica);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RetrievalResult(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult) ProtoMessageGroup(com.ms.silverking.cloud.dht.net.ProtoMessageGroup)

Example 2 with ProtoMessageGroup

use of com.ms.silverking.cloud.dht.net.ProtoMessageGroup in project SilverKing by Morgan-Stanley.

the class OpSender method createMessages.

/**
 * Given a group of same-typed operations, create and send messages.
 * @param asyncOpImpls
 * @param startIndex
 * @param endIndex
 */
private void createMessages(AsyncOperationImpl[] asyncOpImpls, int startIndex, int endIndex) {
    ProtoMessageGroup protoMG;
    List<MessageGroup> messageGroups;
    MessageEstimate estimate;
    estimate = estimateMessage(asyncOpImpls, startIndex, endIndex);
    protoMG = asyncOpImpls[startIndex].createProtoMG(estimate);
    if (debug) {
        System.out.printf("asyncOpImpls.length %d startIndex %d endIndex %d\n", asyncOpImpls.length, startIndex, endIndex);
    }
    messageGroups = new ArrayList<>();
    // then create a new protoMG and add the old to the messageGroups list.
    for (int i = startIndex; i <= endIndex; i++) {
        if (debug) {
            System.out.printf("Calling create with %s\tfor%s\n", protoMG.getUUID(), asyncOpImpls[i].objectToString());
        }
        protoMG = asyncOpImpls[i].createMessagesForIncomplete(protoMG, messageGroups, estimate);
    }
    // Add the final protoMG to the list if it is non-empty
    protoMG.addToMessageGroupList(messageGroups);
    // FUTURE - consider sending sooner, in creation loop
    for (MessageGroup messageGroup : messageGroups) {
        if (debug) {
            System.out.println("OpSender sending:");
            System.out.println(messageGroup);
            messageGroup.displayForDebug();
        }
        send(messageGroup);
    }
}
Also used : ProtoMessageGroup(com.ms.silverking.cloud.dht.net.ProtoMessageGroup) MessageGroup(com.ms.silverking.cloud.dht.net.MessageGroup) ProtoMessageGroup(com.ms.silverking.cloud.dht.net.ProtoMessageGroup)

Aggregations

ProtoMessageGroup (com.ms.silverking.cloud.dht.net.ProtoMessageGroup)2 RetrievalResult (com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult)1 MessageGroup (com.ms.silverking.cloud.dht.net.MessageGroup)1 IPAndPort (com.ms.silverking.net.IPAndPort)1