use of com.ms.silverking.cloud.dht.common.DHTKey in project SilverKing by Morgan-Stanley.
the class ActiveProxyPut method localOp_putupdate.
protected void localOp_putupdate(List<? extends DHTKey> _entries, PutCommunicator pComm) {
List<OpResult> results;
int _entriesSize;
results = getStorage().putUpdate(getContext(), _entries, getVersion());
_entriesSize = _entries.size();
if (results.size() != _entriesSize) {
throw new RuntimeException("panic");
}
for (int i = 0; i < _entriesSize; i++) {
DHTKey _entry;
MessageGroupKeyOrdinalEntry mgkoEntry;
OpResult result;
_entry = _entries.get(i);
if (debug) {
System.out.printf("localOp_putupdate: %s\n", _entry);
}
mgkoEntry = (MessageGroupKeyOrdinalEntry) _entry;
result = results.get(i);
storageOperation.localUpdate(_entry, mgkoEntry.getOrdinal(), result, pComm);
}
}
use of com.ms.silverking.cloud.dht.common.DHTKey in project SilverKing by Morgan-Stanley.
the class StringMD5KeyCreator method main.
public static void main(String[] args) {
StringMD5KeyCreator stringMD5KeyCreator;
DHTKey key;
DHTKey[] subKeys;
int numSubKeys;
stringMD5KeyCreator = new StringMD5KeyCreator();
System.out.printf("%s\t%s\n", args[0], stringMD5KeyCreator.createKey(args[0]));
/*
key = stringMD5KeyCreator.createKey("GeorgeWashington");
numSubKeys = 5;
subKeys = stringMD5KeyCreator.createSubKeys(key, numSubKeys);
System.out.println(key);
for (int i = 0; i < subKeys.length; i++) {
System.out.printf("%d\t%s\n", i, subKeys[i]);
}
*/
}
use of com.ms.silverking.cloud.dht.common.DHTKey in project SilverKing by Morgan-Stanley.
the class KVSerializationTest method runTest.
public void runTest(int numKeys, BufferMode bufferMode) {
SerializedKeyValueBuffers skvBuffers;
Stopwatch sw;
ThreadLocalRandom random;
skvBuffers = new SerializedKeyValueBuffers();
random = ThreadLocalRandom.current();
sw = new SimpleStopwatch();
for (int i = 0; i < numKeys; i++) {
DHTKey key;
ByteBuffer value;
key = new SimpleKey(random.nextLong(), random.nextLong());
value = randomValue(random);
skvBuffers.addKeyValue(key, value, bufferMode);
}
sw.stop();
System.out.println(skvBuffers);
System.out.printf("Elapsed %f\n", sw.getElapsedSeconds());
skvBuffers.freeze();
display(skvBuffers);
}
use of com.ms.silverking.cloud.dht.common.DHTKey in project SilverKing by Morgan-Stanley.
the class SingleKeyToDHTKeyMap method put.
@Override
public DHTKey put(K key, DHTKey dhtKey) {
if (this.key == null || key.equals(this.key)) {
DHTKey _dhtKey;
_dhtKey = this.dhtKey;
this.key = key;
this.dhtKey = dhtKey;
return _dhtKey;
} else {
throw new RuntimeException("This map can only hold one key-value pair " + this.key + " " + key);
}
}
use of com.ms.silverking.cloud.dht.common.DHTKey in project SilverKing by Morgan-Stanley.
the class DHTKeyEntryBase method equals.
@Override
public boolean equals(Object o) {
DHTKey oKey;
oKey = (DHTKey) o;
return lsl == oKey.getLSL() && msl == oKey.getMSL();
}
Aggregations