Search in sources :

Example 6 with NamespaceProperties

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);
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) DataSegmentWalkEntry(com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalkEntry) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) DataSegmentWalker(com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalker) ByteBuffer(java.nio.ByteBuffer)

Example 7 with NamespaceProperties

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);
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) NamespaceServerSideCode(com.ms.silverking.cloud.dht.NamespaceServerSideCode)

Example 8 with NamespaceProperties

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();
    }
}
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 9 with NamespaceProperties

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();
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties)

Example 10 with NamespaceProperties

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);
    }
}
Also used : NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) SimpleNamespaceCreator(com.ms.silverking.cloud.dht.client.impl.SimpleNamespaceCreator)

Aggregations

NamespaceProperties (com.ms.silverking.cloud.dht.common.NamespaceProperties)16 NamespaceOptions (com.ms.silverking.cloud.dht.NamespaceOptions)8 IOException (java.io.IOException)6 File (java.io.File)4 SimpleNamespaceCreator (com.ms.silverking.cloud.dht.client.impl.SimpleNamespaceCreator)3 ByteBuffer (java.nio.ByteBuffer)2 NamespaceServerSideCode (com.ms.silverking.cloud.dht.NamespaceServerSideCode)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 DHTKeyIntEntry (com.ms.silverking.cloud.dht.collection.DHTKeyIntEntry)1 TableFullException (com.ms.silverking.cloud.dht.collection.TableFullException)1 Context (com.ms.silverking.cloud.dht.common.Context)1 CorruptValueException (com.ms.silverking.cloud.dht.common.CorruptValueException)1 KeyAndInteger (com.ms.silverking.cloud.dht.common.KeyAndInteger)1 DataSegmentWalkEntry (com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalkEntry)1 DataSegmentWalker (com.ms.silverking.cloud.dht.daemon.storage.DataSegmentWalker)1 SegmentPrereadMode (com.ms.silverking.cloud.dht.daemon.storage.FileSegment.SegmentPrereadMode)1 NamespaceNotCreatedException (com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException)1 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)1 SSNamespaceStore (com.ms.silverking.cloud.dht.serverside.SSNamespaceStore)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1