Search in sources :

Example 1 with ProtoRetrievalMessageGroup

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

the class AsyncRetrievalOperationImpl method retrieveSegments.

private void retrieveSegments(DHTKey relayKey, DHTKey[] segmentKeys, MetaData metaData) {
    List<MessageGroup> messageGroups;
    SegmentedRetrievalValue<K, V> segmentedRetrievalValue;
    if (segmentedRetrievalValues == null) {
        segmentedRetrievalValues = new ArrayList<>(segmentKeys.length);
    }
    segmentedRetrievalValue = new SegmentedRetrievalValue<>(segmentKeys, relayKey, this, nspoImpl.getValueDeserializer(), metaData);
    messageGroups = new ArrayList<>();
    for (DHTKey segmentKey : segmentKeys) {
        ProtoRetrievalMessageGroup protoRetrievalMG;
        boolean listenerInserted;
        List<WeakReference<ActiveKeyedOperationResultListener<MessageGroupRetrievalResponseEntry>>> listeners;
        protoRetrievalMG = createProtoRetrievalMG(new KeyedMessageEstimate(1), false);
        listenerInserted = activeRetrievalListeners.addListener(protoRetrievalMG.getUUID(), segmentKey, segmentedRetrievalValue);
        if (!listenerInserted) {
            throw new RuntimeException("Duplicate listener insertion");
        }
        protoRetrievalMG.addKey(segmentKey);
        protoRetrievalMG.addToMessageGroupList(messageGroups);
        // hold a reference to the uuid to prevent GC
        opUUIDs.add((OperationUUID) protoRetrievalMG.getUUID());
        segmentedRetrievalValues.add(segmentedRetrievalValue);
    }
    for (MessageGroup messageGroup : messageGroups) {
        retrievalSender.send(messageGroup);
    }
}
Also used : MessageGroup(com.ms.silverking.cloud.dht.net.MessageGroup) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) ProtoMessageGroup(com.ms.silverking.cloud.dht.net.ProtoMessageGroup) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) MessageGroupRetrievalResponseEntry(com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry) WeakReference(java.lang.ref.WeakReference)

Example 2 with ProtoRetrievalMessageGroup

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

the class AsyncRetrievalOperationImpl method createProtoRetrievalMG.

private ProtoRetrievalMessageGroup createProtoRetrievalMG(MessageEstimate estimate, boolean verifyIntegrity) {
    OperationUUID opUUID;
    ConcurrentMap<DHTKey, List<ActiveKeyedOperationResultListener<MessageGroupRetrievalResponseEntry>>> newMap;
    KeyedMessageEstimate keyedMessageEstimate;
    int relDeadline;
    keyedMessageEstimate = (KeyedMessageEstimate) estimate;
    opUUID = activeRetrievalListeners.newOpUUID();
    relDeadline = operation.getTimeoutController().getMaxRelativeTimeoutMillis(this);
    if (debugShortTimeout) {
        if (relDeadline < shortTimeoutLimit) {
            Log.warning("short relDeadline: " + relDeadline);
            // Log.warning(timeoutParameters.computeTimeout(keyedMessageEstimate.getNumKeys()));
            Log.warning(timeoutState.getCurRelTimeoutMillis());
        // throw new RuntimeException();
        }
    }
    return new ProtoRetrievalMessageGroup(opUUID, context.contextAsLong(), new InternalRetrievalOptions(retrievalOperation.retrievalOptions(), verifyIntegrity), originator, keyedMessageEstimate.getNumKeys(), relDeadline, retrievalOperation.retrievalOptions().getForwardingMode());
}
Also used : DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) MessageGroupRetrievalResponseEntry(com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions) VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint)

Example 3 with ProtoRetrievalMessageGroup

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

the class AsyncRetrievalOperationImpl method handleCorruptValue.

private void handleCorruptValue(DHTKey key) {
    ProtoRetrievalMessageGroup protoRetrievalMG;
    boolean listenerInserted;
    protoRetrievalMG = createProtoRetrievalMG(new KeyedMessageEstimate(1), true);
    listenerInserted = activeRetrievalListeners.addListener(protoRetrievalMG.getUUID(), key, this);
    if (!listenerInserted) {
        throw new RuntimeException("Duplicate listener insertion");
    }
    protoRetrievalMG.addKey(key);
    // hold a reference to the uuid to prevent GC
    opUUIDs.add((OperationUUID) protoRetrievalMG.getUUID());
    retrievalSender.send(protoRetrievalMG.toMessageGroup());
}
Also used : ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup)

Example 4 with ProtoRetrievalMessageGroup

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

the class ActiveRegionSync method sendSyncRetrievalRequest.

private void sendSyncRetrievalRequest(SyncRetrievalRequest srr) {
    MessageGroup mg;
    RetrievalOptions retrievalOptions;
    Log.warningAsyncf("ars %s send srr %s", uuid, srr.getUUID());
    inprocessSyncRetrievalRequests.add(srr.getUUID());
    retrievalOptions = OptionsHelper.newRetrievalOptions(RetrievalType.VALUE_AND_META_DATA, WaitMode.GET, checksumVersionConstraint(srr.dataVersion));
    mg = new ProtoRetrievalMessageGroup(srr.uuid, namespace, new InternalRetrievalOptions(retrievalOptions), mgBase.getMyID(), srr.outstandingKeys, convergenceRelativeDeadlineMillis).toMessageGroup();
    // outgoingMessages.add(new OutgoingMessage(mg, new IPAndPort(srr.connection.getRemoteSocketAddress())));
    mgBase.send(mg, srr.connection.getRemoteIPAndPort());
}
Also used : RetrievalOptions(com.ms.silverking.cloud.dht.RetrievalOptions) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions) ProtoChecksumTreeRequestMessageGroup(com.ms.silverking.cloud.dht.net.ProtoChecksumTreeRequestMessageGroup) MessageGroup(com.ms.silverking.cloud.dht.net.MessageGroup) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)

Example 5 with ProtoRetrievalMessageGroup

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

the class ConvergenceController2 method sendSyncRetrievalRequest.

private void sendSyncRetrievalRequest(SyncRetrievalRequest srr) {
    MessageGroup mg;
    RetrievalOptions retrievalOptions;
    retrievalOptions = OptionsHelper.newRetrievalOptions(RetrievalType.VALUE_AND_META_DATA, WaitMode.GET, checksumVersionConstraint(srr.dataVersion));
    mg = new ProtoRetrievalMessageGroup(srr.uuid, ns, new InternalRetrievalOptions(retrievalOptions), mgBase.getMyID(), srr.outstandingKeys, convergenceRelativeDeadlineMillis).toMessageGroup();
    outgoingMessages.add(new OutgoingMessage(mg, new IPAndPort(srr.connection.getRemoteSocketAddress())));
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions) RetrievalOptions(com.ms.silverking.cloud.dht.RetrievalOptions) ProtoChecksumTreeRequestMessageGroup(com.ms.silverking.cloud.dht.net.ProtoChecksumTreeRequestMessageGroup) MessageGroup(com.ms.silverking.cloud.dht.net.MessageGroup) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) ProtoRetrievalMessageGroup(com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)

Aggregations

ProtoRetrievalMessageGroup (com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup)5 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)3 MessageGroup (com.ms.silverking.cloud.dht.net.MessageGroup)3 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)2 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)2 MessageGroupRetrievalResponseEntry (com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry)2 ProtoChecksumTreeRequestMessageGroup (com.ms.silverking.cloud.dht.net.ProtoChecksumTreeRequestMessageGroup)2 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 ProtoMessageGroup (com.ms.silverking.cloud.dht.net.ProtoMessageGroup)1 IPAndPort (com.ms.silverking.net.IPAndPort)1 WeakReference (java.lang.ref.WeakReference)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1