Search in sources :

Example 11 with NamespaceOptions

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

the class ClientTool method doGetNamespaceOptions.

private void doGetNamespaceOptions(ClientOptions options, DHTSession session, Stopwatch sw) throws OperationException, IOException {
    long version;
    NamespaceOptions nsOptions;
    Log.warning("Getting namespace options");
    nsOptions = null;
    sw.reset();
    for (int i = 0; i < options.reps; i++) {
        nsOptions = session.getNamespace(options.namespace).getOptions();
    }
    sw.stop();
    System.out.println(nsOptions);
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint)

Example 12 with NamespaceOptions

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

the class DHTSessionImpl method getClientNamespace.

private ClientNamespace getClientNamespace(String namespace) {
    ClientNamespace clientNamespace;
    Context context;
    context = namespaceCreator.createNamespace(namespace);
    clientNamespace = clientNamespaces.get(context.contextAsLong());
    if (clientNamespace == null) {
        ClientNamespace previous;
        NamespaceProperties nsProperties;
        NamespaceOptions nsOptions;
        ClientNamespace parent;
        NamespaceLinkMeta nsLinkMeta;
        nsProperties = getNamespaceProperties(namespace);
        if (nsProperties == null) {
            throw new NamespaceNotCreatedException(namespace);
        }
        nsOptions = nsProperties.getOptions();
        if (nsProperties.getParent() != null) {
            parent = getClientNamespace(nsProperties.getParent());
        } else {
            parent = null;
        }
        if (nsOptions.getAllowLinks() && nsOptions.getVersionMode() == NamespaceVersionMode.SINGLE_VERSION) {
            nsLinkMeta = getNSLinkMeta();
        } else {
            nsLinkMeta = null;
        }
        clientNamespace = new ClientNamespace(this, namespace, nsOptions, serializationRegistry, absMillisTimeSource, server, parent, nsLinkMeta);
        previous = clientNamespaces.putIfAbsent(context.contextAsLong(), clientNamespace);
        if (previous != null) {
            clientNamespace = previous;
        } else {
            if (Log.levelMet(Level.INFO)) {
                Log.info("Created client namespace: " + namespace + " " + context);
            }
            clientNamespaceList.add(clientNamespace);
        }
    }
    return clientNamespace;
}
Also used : Context(com.ms.silverking.cloud.dht.common.Context) NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) NamespaceNotCreatedException(com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException)

Example 13 with NamespaceOptions

use of com.ms.silverking.cloud.dht.NamespaceOptions 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 14 with NamespaceOptions

use of com.ms.silverking.cloud.dht.NamespaceOptions 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 15 with NamespaceOptions

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

the class ObjectDefParserTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        ObjectDefParserTest test;
        String def;
        NamespaceOptions nsOptions;
        DHTUtil.currentTimeMillis();
        System.out.println();
        System.out.println("\n\n=================================\n\n");
        // System.out.println(DHTConstants.standardPutOptions);
        // System.out.println(DHTConstants.standardGetOptions);
        /*
            try {
                NamespaceOptions.parse("");
            } catch (Exception e) {
            }
            try {
                def = new SecondaryTarget(SecondaryTargetType.AncestorClass, "").toString();
            } catch (Exception e) {
            }
            */
        new SecondaryTarget(null, null);
        def = "defaultPutOptions={secondaryTargets={{type=AncestorClass,target=Campus}}}";
        nsOptions = ObjectDefParser2.parse(NamespaceOptions.class, def);
        System.exit(0);
        def = new NamespaceOptions(DHTConstants.defaultStorageType, DHTConstants.defaultConsistencyProtocol, DHTConstants.defaultVersionMode, DHTConstants.defaultRevisionMode, DHTConstants.standardPutOptions.secondaryTargets(new SecondaryTarget(SecondaryTargetType.AncestorClass, "Region")), DHTConstants.standardInvalidationOptions, DHTConstants.standardGetOptions, DHTConstants.standardWaitOptions, 0, 0, false).toString();
        /*
            def = new NamespaceOptions(DHTConstants.defaultStorageType, DHTConstants.defaultConsistencyProtocol, 
                    DHTConstants.defaultVersionMode, DHTConstants.standardPutOptions,
                    DHTConstants.standardGetOptions, DHTConstants.standardWaitOptions).toString();
                    */
        System.out.println(def);
        System.out.println();
        nsOptions = ObjectDefParser2.parse(NamespaceOptions.class, def);
        System.out.println(nsOptions);
        for (SecondaryTarget target : nsOptions.getDefaultPutOptions().getSecondaryTargets()) {
            System.out.println(target);
        }
    // test = new ObjectDefParserTest();
    // test.test(def);
    /*
            for (String arg : args) {
                test.test(arg);
            }
            */
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SecondaryTarget(com.ms.silverking.cloud.dht.SecondaryTarget) NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions)

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