Search in sources :

Example 6 with DHTSession

use of com.ms.silverking.cloud.dht.client.DHTSession in project SilverKing by Morgan-Stanley.

the class DebugKey method replicaContainsKey.

private boolean replicaContainsKey(IPAndPort replica, String key) throws ClientException {
    DHTSession dhtSession;
    SynchronousNamespacePerspective<String, byte[]> nsp;
    RetrievalOptions ro;
    StoredValue<byte[]> storedValue;
    dhtSession = dhtClient.openSession(new SessionOptions(gc, replica.getIPAsString()));
    nsp = dhtSession.openSyncNamespacePerspective(namespace, String.class, byte[].class);
    ro = nsp.getNamespace().getOptions().getDefaultGetOptions();
    ro = ro.retrievalType(RetrievalType.META_DATA);
    ro = ro.forwardingMode(ForwardingMode.DO_NOT_FORWARD);
    ro = ro.nonExistenceResponse(NonExistenceResponse.NULL_VALUE);
    storedValue = nsp.retrieve(key, ro);
    nsp.close();
    dhtSession.close();
    if (storedValue == null) {
        return false;
    } else {
        // out.println(storedValue.getMetaData());
        return true;
    }
}
Also used : RetrievalOptions(com.ms.silverking.cloud.dht.RetrievalOptions) SessionOptions(com.ms.silverking.cloud.dht.SessionOptions) DHTSession(com.ms.silverking.cloud.dht.client.DHTSession)

Example 7 with DHTSession

use of com.ms.silverking.cloud.dht.client.DHTSession in project SilverKing by Morgan-Stanley.

the class SingleVersionUnrestrictedRevisionsTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ClientException, IOException {
    DHTSession session = createSession();
    Namespace ns = createNamespace(session, namespaceName, SINGLE_VERSION, UNRESTRICTED_REVISIONS);
    syncNsp = ns.openSyncPerspective(String.class, String.class);
}
Also used : DHTSession(com.ms.silverking.cloud.dht.client.DHTSession) Namespace(com.ms.silverking.cloud.dht.client.Namespace) BeforeClass(org.junit.BeforeClass)

Example 8 with DHTSession

use of com.ms.silverking.cloud.dht.client.DHTSession in project SilverKing by Morgan-Stanley.

the class ClientSpecifiedVersionNoRevisionsTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ClientException, IOException {
    DHTSession session = createSession();
    Namespace ns = createNamespace(session, namespaceName, CLIENT_SPECIFIED, NO_REVISIONS);
    syncNsp = ns.openSyncPerspective(String.class, String.class);
}
Also used : DHTSession(com.ms.silverking.cloud.dht.client.DHTSession) Namespace(com.ms.silverking.cloud.dht.client.Namespace) BeforeClass(org.junit.BeforeClass)

Example 9 with DHTSession

use of com.ms.silverking.cloud.dht.client.DHTSession in project SilverKing by Morgan-Stanley.

the class SingleVersionNoRevisionsTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ClientException, IOException {
    DHTSession session = createSession();
    Namespace ns = createNamespace(session, namespaceName, SINGLE_VERSION, NO_REVISIONS);
    syncNsp = ns.openSyncPerspective(String.class, String.class);
}
Also used : DHTSession(com.ms.silverking.cloud.dht.client.DHTSession) Namespace(com.ms.silverking.cloud.dht.client.Namespace) BeforeClass(org.junit.BeforeClass)

Aggregations

DHTSession (com.ms.silverking.cloud.dht.client.DHTSession)9 Namespace (com.ms.silverking.cloud.dht.client.Namespace)6 BeforeClass (org.junit.BeforeClass)4 SessionOptions (com.ms.silverking.cloud.dht.SessionOptions)2 DHTClient (com.ms.silverking.cloud.dht.client.DHTClient)2 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)2 Stopwatch (com.ms.silverking.time.Stopwatch)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 GetOptions (com.ms.silverking.cloud.dht.GetOptions)1 PutOptions (com.ms.silverking.cloud.dht.PutOptions)1 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 ClientDHTConfiguration (com.ms.silverking.cloud.dht.client.ClientDHTConfiguration)1 PutException (com.ms.silverking.cloud.dht.client.PutException)1 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)1 ZooKeeperConfig (com.ms.silverking.cloud.zookeeper.ZooKeeperConfig)1 DBException (com.yahoo.ycsb.DBException)1 IOException (java.io.IOException)1