Search in sources :

Example 16 with DHTKey

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);
    }
}
Also used : MessageGroupKeyOrdinalEntry(com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry) OpResult(com.ms.silverking.cloud.dht.common.OpResult) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey)

Example 17 with DHTKey

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]);
        }
        */
}
Also used : DHTKey(com.ms.silverking.cloud.dht.common.DHTKey)

Example 18 with DHTKey

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);
}
Also used : SerializedKeyValueBuffers(com.ms.silverking.cloud.dht.client.serialization.internal.SerializedKeyValueBuffers) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Stopwatch(com.ms.silverking.time.Stopwatch) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) ByteBuffer(java.nio.ByteBuffer) SimpleKey(com.ms.silverking.cloud.dht.common.SimpleKey)

Example 19 with DHTKey

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);
    }
}
Also used : DHTKey(com.ms.silverking.cloud.dht.common.DHTKey)

Example 20 with DHTKey

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();
}
Also used : DHTKey(com.ms.silverking.cloud.dht.common.DHTKey)

Aggregations

DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)47 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)10 OpResult (com.ms.silverking.cloud.dht.common.OpResult)7 ByteBuffer (java.nio.ByteBuffer)7 KeyAndVersionChecksum (com.ms.silverking.cloud.dht.daemon.storage.KeyAndVersionChecksum)5 SimpleKey (com.ms.silverking.cloud.dht.common.SimpleKey)4 MessageGroupKeyOrdinalEntry (com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry)4 MessageGroupRetrievalResponseEntry (com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry)4 IOException (java.io.IOException)4 WeakReference (java.lang.ref.WeakReference)4 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 ProtoRetrievalMessageGroup (com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup)3 Triple (com.ms.silverking.collection.Triple)3 File (java.io.File)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 ConcurrentMap (java.util.concurrent.ConcurrentMap)3 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)2 DHTKeyIntEntry (com.ms.silverking.cloud.dht.collection.DHTKeyIntEntry)2