Search in sources :

Example 31 with OpResult

use of com.ms.silverking.cloud.dht.common.OpResult in project SilverKing by Morgan-Stanley.

the class StorageModule method putUpdate.

public List<OpResult> putUpdate(long ns, List<? extends DHTKey> updates, long version) {
    NamespaceStore nsStore;
    nsStore = getNamespaceStore(ns, NSCreationMode.DoNotCreate);
    if (nsStore != null) {
        return nsStore.putUpdate(updates, version);
    } else {
        List<OpResult> results;
        results = new ArrayList<>(updates.size());
        for (int i = 0; i < updates.size(); i++) {
            results.add(OpResult.NO_SUCH_VALUE);
        }
        return results;
    }
}
Also used : OpResult(com.ms.silverking.cloud.dht.common.OpResult) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)

Example 32 with OpResult

use of com.ms.silverking.cloud.dht.common.OpResult 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();
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) OpResult(com.ms.silverking.cloud.dht.common.OpResult) RetrievalCommunicator(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) MessageGroupRetrievalResponseEntry(com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry) RetrievalResult(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult)

Aggregations

OpResult (com.ms.silverking.cloud.dht.common.OpResult)32 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)7 IOException (java.io.IOException)5 ProtoOpResponseMessageGroup (com.ms.silverking.cloud.dht.net.ProtoOpResponseMessageGroup)4 Waiter (com.ms.silverking.cloud.dht.daemon.Waiter)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 MessageGroupKeyOrdinalEntry (com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry)3 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)2 MessageGroupRetrievalResponseEntry (com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry)2 IPAndPort (com.ms.silverking.net.IPAndPort)2 WeakReference (java.lang.ref.WeakReference)2 ImmutableList (com.google.common.collect.ImmutableList)1 NamespaceVersionMode (com.ms.silverking.cloud.dht.NamespaceVersionMode)1 NonExistenceResponse (com.ms.silverking.cloud.dht.NonExistenceResponse)1 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)1 WaitOptions (com.ms.silverking.cloud.dht.WaitOptions)1 CorruptValueException (com.ms.silverking.cloud.dht.common.CorruptValueException)1 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)1 RawRetrievalResult (com.ms.silverking.cloud.dht.common.RawRetrievalResult)1 SimpleKey (com.ms.silverking.cloud.dht.common.SimpleKey)1