Search in sources :

Example 1 with MessageGroupPutEntry

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

the class BaseStorageOperation method processInitialMessageGroupEntry.

@Override
public void processInitialMessageGroupEntry(MessageGroupKeyEntry _entry, List<IPAndPort> primaryReplicas, List<IPAndPort> secondaryReplicas, OpVirtualCommunicator<MessageGroupKeyEntry, PutResult> pvComm) {
    MessageGroupPutEntry entry;
    if (debug) {
        System.out.printf("processInitialMessageGroupEntry() %d\n", primaryReplicas.size());
    }
    entry = (MessageGroupPutEntry) _entry;
    if (forwardingMode.forwards()) {
        if (putOperationContainer.getSecondaryTargets() == null) {
            // Eagerly write to secondary replicas *only* if targets have
            // been defined. FUTURE - could change.
            secondaryReplicas = ImmutableList.of();
        }
        initializeEntryState(entry, primaryReplicas, secondaryReplicas);
        for (IPAndPort replica : primaryReplicas) {
            pvComm.forwardEntry(replica, entry);
        }
        if (putOperationContainer.getSecondaryTargets() != null) {
            for (IPAndPort replica : secondaryReplicas) {
                pvComm.forwardEntry(replica, entry);
            }
        }
    } else {
        pvComm.forwardEntry(putOperationContainer.localIPAndPort(), entry);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) MessageGroupPutEntry(com.ms.silverking.cloud.dht.net.MessageGroupPutEntry)

Example 2 with MessageGroupPutEntry

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

the class ActiveProxyPut method localOp.

protected void localOp(List<? extends DHTKey> _entries, OpCommunicator<MessageGroupKeyEntry, PutResult> comm) {
    boolean useUpdate;
    PutCommunicator pComm;
    pComm = (PutCommunicator) comm;
    useUpdate = _entries.size() > 0 && (_entries.get(0) instanceof MessageGroupKeyOrdinalEntry);
    if (!useUpdate) {
        List<StorageValueAndParameters> values;
        long creationTime;
        creationTime = SystemTimeUtil.systemTimeSource.absTimeNanos();
        values = new ArrayList<>(_entries.size());
        for (DHTKey _entry : _entries) {
            values.add(new StorageValueAndParameters((MessageGroupPutEntry) _entry, (PutOperationContainer) this, creationTime));
            if (debug) {
                System.out.printf("localOp: %s\n", _entry);
            }
        // Log.fine(entry);
        }
        getStorage().put(getContext(), values, getUserData(), pComm);
        if (forwardingMode.forwards()) {
            for (DHTKey _entry : _entries) {
                storageOperation.localUpdate(_entry, StorageProtocolUtil.initialStorageStateOrdinal, OpResult.SUCCEEDED, pComm);
            }
        }
    } else {
        localOp_putupdate(_entries, pComm);
    }
}
Also used : MessageGroupKeyOrdinalEntry(com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry) PutCommunicator(com.ms.silverking.cloud.dht.daemon.storage.protocol.PutCommunicator) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) PutOperationContainer(com.ms.silverking.cloud.dht.daemon.storage.protocol.PutOperationContainer) StorageValueAndParameters(com.ms.silverking.cloud.dht.daemon.storage.StorageValueAndParameters) MessageGroupPutEntry(com.ms.silverking.cloud.dht.net.MessageGroupPutEntry)

Aggregations

MessageGroupPutEntry (com.ms.silverking.cloud.dht.net.MessageGroupPutEntry)2 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)1 StorageValueAndParameters (com.ms.silverking.cloud.dht.daemon.storage.StorageValueAndParameters)1 PutCommunicator (com.ms.silverking.cloud.dht.daemon.storage.protocol.PutCommunicator)1 PutOperationContainer (com.ms.silverking.cloud.dht.daemon.storage.protocol.PutOperationContainer)1 MessageGroupKeyOrdinalEntry (com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry)1 IPAndPort (com.ms.silverking.net.IPAndPort)1