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);
}
}
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);
}
}
Aggregations