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);
}
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();
}
}
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();
}
}
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()];
}
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);
}
}
Aggregations