Search in sources :

Example 6 with Namespace

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

the class PerspectiveTest method test_NamespaceOptions_vs_NamespacePerspectiveOptions.

// @Test
public void test_NamespaceOptions_vs_NamespacePerspectiveOptions() throws ClientException, IOException {
    Namespace ns = session.createNamespace(namespaceName, session.getDefaultNamespaceOptions().versionMode(NamespaceVersionMode.CLIENT_SPECIFIED).revisionMode(RevisionMode.UNRESTRICTED_REVISIONS));
    SynchronousNamespacePerspective<String, String> syncNSPString = ns.openSyncPerspective(String.class, String.class);
    SynchronousNamespacePerspective<String, Integer> syncNSPInt = ns.openSyncPerspective(String.class, Integer.class);
    PutOptions poString = syncNSPString.getOptions().getDefaultPutOptions();
    GetOptions goString = syncNSPString.getOptions().getDefaultGetOptions();
    PutOptions poInt = syncNSPInt.getOptions().getDefaultPutOptions();
    GetOptions goInt = syncNSPInt.getOptions().getDefaultGetOptions();
    syncNSPString.put("k", "v1", poString.version(1));
    syncNSPInt.put("k", 2, poInt.version(2));
    System.out.println(syncNSPString);
    System.out.println(syncNSPString.get("k"));
    System.out.println(syncNSPString.get("k", goString.versionConstraint(VersionConstraint.exactMatch(1))).getValue());
    System.out.println("-");
    System.out.println(syncNSPInt.get("k"));
    System.out.println(syncNSPInt.get("k", goInt.versionConstraint(VersionConstraint.exactMatch(2))).getValue());
    System.out.println(syncNSPInt.get("k", goInt.versionConstraint(VersionConstraint.exactMatch(1))).getValue());
}
Also used : GetOptions(com.ms.silverking.cloud.dht.GetOptions) Namespace(com.ms.silverking.cloud.dht.client.Namespace) PutOptions(com.ms.silverking.cloud.dht.PutOptions)

Example 7 with Namespace

use of com.ms.silverking.cloud.dht.client.Namespace 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 Namespace

use of com.ms.silverking.cloud.dht.client.Namespace 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 Namespace

use of com.ms.silverking.cloud.dht.client.Namespace 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

Namespace (com.ms.silverking.cloud.dht.client.Namespace)9 DHTSession (com.ms.silverking.cloud.dht.client.DHTSession)6 BeforeClass (org.junit.BeforeClass)4 GetOptions (com.ms.silverking.cloud.dht.GetOptions)2 PutOptions (com.ms.silverking.cloud.dht.PutOptions)2 SessionOptions (com.ms.silverking.cloud.dht.SessionOptions)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 ConstantVersionProvider (com.ms.silverking.cloud.dht.client.ConstantVersionProvider)1 DHTClient (com.ms.silverking.cloud.dht.client.DHTClient)1 NamespaceNotCreatedException (com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1 Stopwatch (com.ms.silverking.time.Stopwatch)1 IOException (java.io.IOException)1 Test (org.junit.Test)1