Search in sources :

Example 16 with NamespaceOptions

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

the class NamespaceOptionsTest method testWriteOnce.

@Test
public void testWriteOnce() {
    checkIsWriteOnce(defaultNsOptions);
    assertFalse(defaultNsOptionsDiff.isWriteOnce());
    NamespaceOptions nsWriteOnce = defaultNsOptionsDiff.asWriteOnce();
    checkIsWriteOnce(nsWriteOnce);
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) Test(org.junit.Test)

Example 17 with NamespaceOptions

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

the class KeySearcher method main.

public static void main(String[] args) {
    try {
        if (args.length != 2) {
            System.err.println("args: <path> <key1,key2...>");
        } else {
            File path;
            Set<String> keys;
            NamespaceProperties nsProperties;
            NamespaceOptions nsOptions;
            KeySearcher keySearcher;
            path = new File(args[0]);
            keys = CollectionUtil.parseSet(args[1], ",");
            nsProperties = NamespacePropertiesIO.read(path);
            nsOptions = nsProperties.getOptions();
            keySearcher = new KeySearcher(keys, nsOptions);
            keySearcher.searchSegments(path);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) File(java.io.File) IOException(java.io.IOException)

Example 18 with NamespaceOptions

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

the class MessageModule method handlePut.

private void handlePut(MessageGroup message, MessageGroupConnectionProxy connection) {
    NamespaceProperties nsProperties;
    NamespaceOptions nsOptions;
    nsProperties = storage.getNamespaceProperties(message.getContext(), NamespaceOptionsRetrievalMode.FetchRemotely);
    nsOptions = nsProperties.getOptions();
    if (message.getForwardingMode().forwards()) {
        new ActiveProxyPut(message, connection, this, getStorageProtocol(nsOptions), message.getDeadlineAbsMillis(absMillisTimeSource), false, nsOptions).startOperation();
    } else {
        new ActiveProxyPut(message, connection, this, getLocalStorageProtocol(nsOptions), message.getDeadlineAbsMillis(absMillisTimeSource), true, nsOptions).startOperation();
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties)

Example 19 with NamespaceOptions

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

the class MessageModule method getRetrievalProtocol.

private RetrievalProtocol getRetrievalProtocol(NamespaceProperties nsProperties) {
    NamespaceOptions nsOptions;
    assert nsProperties != null;
    nsOptions = nsProperties.getOptions();
    assert nsOptions.getConsistencyProtocol() != null;
    return consistencyModeToRetrievalProtocol[nsOptions.getConsistencyProtocol().ordinal()];
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions)

Example 20 with NamespaceOptions

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

the class NamespaceOptionsIO method write.

public static void write(File nsDir, NamespaceOptions nsOptions) throws IOException {
    if (!nsDir.isDirectory()) {
        throw new IOException("NamespaceOptionsIO.write() passed non-directory: " + nsDir);
    }
    if (optionsFileExists(nsDir)) {
        NamespaceOptions existingOptions;
        existingOptions = read(nsDir);
        if (!nsOptions.equals(existingOptions)) {
            System.err.println(nsOptions);
            System.err.println(existingOptions);
            throw new RuntimeException("Existing options != nsOptions");
        }
    } else {
        _write(optionsFile(nsDir), nsOptions);
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) IOException(java.io.IOException)

Aggregations

NamespaceOptions (com.ms.silverking.cloud.dht.NamespaceOptions)24 NamespaceProperties (com.ms.silverking.cloud.dht.common.NamespaceProperties)8 IOException (java.io.IOException)7 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)4 File (java.io.File)4 NamespaceNotCreatedException (com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException)3 ByteBuffer (java.nio.ByteBuffer)2 NamespaceServerSideCode (com.ms.silverking.cloud.dht.NamespaceServerSideCode)1 SecondaryTarget (com.ms.silverking.cloud.dht.SecondaryTarget)1 TimeAndVersionRetentionPolicy (com.ms.silverking.cloud.dht.TimeAndVersionRetentionPolicy)1 ValueRetentionPolicy (com.ms.silverking.cloud.dht.ValueRetentionPolicy)1 DHTKeyIntEntry (com.ms.silverking.cloud.dht.collection.DHTKeyIntEntry)1 Context (com.ms.silverking.cloud.dht.common.Context)1 DataSegmentWalkEntry (com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalkEntry)1 DataSegmentWalker (com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalker)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1 Stopwatch (com.ms.silverking.time.Stopwatch)1 FileNotFoundException (java.io.FileNotFoundException)1 Date (java.util.Date)1 Test (org.junit.Test)1