use of com.ms.silverking.cloud.dht.common.NamespaceProperties in project SilverKing by Morgan-Stanley.
the class DataMigrationTool method walk.
public void walk(File nsDir, File ssDir, int segmentNumber) throws IOException {
ByteBuffer dataBuf;
DataSegmentWalker dsWalker;
NamespaceProperties nsProperties;
NamespaceOptions nsOptions;
nsProperties = NamespacePropertiesIO.read(nsDir);
nsOptions = nsProperties.getOptions();
dataBuf = FileSegment.getDataSegment(nsDir, segmentNumber, nsOptions.getSegmentSize());
dsWalker = new DataSegmentWalker(dataBuf);
while (dsWalker.hasNext()) {
DataSegmentWalkEntry entry;
entry = dsWalker.next();
System.out.println(entry.getOffset() + " " + entry);
migrateEntry(entry, ssDir);
}
}
use of com.ms.silverking.cloud.dht.common.NamespaceProperties in project SilverKing by Morgan-Stanley.
the class DataMigrationTool method modifyProperties.
private void modifyProperties(File sourceDir) throws IOException {
NamespaceProperties originalProperties;
NamespaceOptions originalOptions;
NamespaceProperties modifiedProperties;
NamespaceOptions modifiedOptions;
originalProperties = NamespacePropertiesIO.read(sourceDir);
originalOptions = originalProperties.getOptions();
modifiedOptions = originalOptions.namespaceServerSideCode(new NamespaceServerSideCode("", "com.ms.silverking.cloud.skfs.dir.serverside.DirectoryServer", "com.ms.silverking.cloud.skfs.dir.serverside.DirectoryServer"));
modifiedProperties = originalProperties.options(modifiedOptions);
NamespacePropertiesIO.rewrite(sourceDir, modifiedProperties);
}
use of com.ms.silverking.cloud.dht.common.NamespaceProperties 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.common.NamespaceProperties 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.common.NamespaceProperties in project SilverKing by Morgan-Stanley.
the class StorageModule method recoverExistingNamespace.
private void recoverExistingNamespace(File nsDir) throws IOException {
try {
long ns;
NamespaceProperties nsProperties;
NamespaceStore parent;
NamespaceStore nsStore;
Log.warning("\t\tRecovering: " + nsDir.getName());
ns = NumConversion.parseHexStringAsUnsignedLong(nsDir.getName());
nsProperties = NamespacePropertiesIO.read(nsDir);
nsMetaStore.setNamespaceProperties(ns, nsProperties);
if (nsProperties.getParent() != null) {
long parentContext;
parentContext = new SimpleNamespaceCreator().createNamespace(nsProperties.getParent()).contextAsLong();
parent = namespaces.get(parentContext);
if (parent == null) {
throw new RuntimeException("Unexpected parent not found: " + parentContext);
}
} else {
parent = null;
}
nsStore = NamespaceStore.recoverExisting(ns, nsDir, parent, null, mgBase, ringMaster, activeRetrievals, zk, nsLinkBasePath, this);
namespaces.put(ns, nsStore);
nsStore.startWatches(zk, nsLinkBasePath, this);
Log.warning("\t\tDone recovering: " + nsDir.getName());
} catch (NumberFormatException nfe) {
nfe.printStackTrace();
Log.warning("Recovery ignoring unexpected nsDir: ", nsDir);
}
}
Aggregations