Search in sources :

Example 6 with NamespaceOptions

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

the class FileSegmentUtil method debugFiles.

public static void debugFiles(DHTKey key, File nsDir, int minSegment, int maxSegment) throws IOException {
    NamespaceOptions nsOptions;
    nsOptions = readNamespaceOptions(nsDir);
    for (int i = minSegment; i <= maxSegment; i++) {
        try {
            new FileSegmentUtil().debugSegment(key, nsDir, i, nsOptions);
        } catch (FileNotFoundException fnfe) {
            System.out.printf("Ignoring FileNotFoundException for segment %d\n", i);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Example 7 with NamespaceOptions

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

the class NamespaceOptionsClient method verifyNamespaceOptions.

private boolean verifyNamespaceOptions(long namespace, NamespaceOptions nsOptions) throws RetrievalException {
    NamespaceOptions existingOptions;
    if (debug) {
        System.out.printf("verifyNamespaceOptions(%x, %s)\n", namespace, nsOptions);
    }
    existingOptions = getNamespaceOptions(namespace);
    if (debug) {
        System.out.println("Done verifyNamespaceOptions");
    }
    return existingOptions.equals(nsOptions);
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions)

Example 8 with NamespaceOptions

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

the class NamespaceOptionsClient method verifyNamespaceProperties.

private boolean verifyNamespaceProperties(long namespace, NamespaceProperties nsProperties) throws RetrievalException {
    NamespaceOptions existingProperties;
    if (debug) {
        System.out.printf("verifyNamespaceProperties(%x, %s)\n", namespace, nsProperties);
    }
    existingProperties = getNamespaceOptions(namespace);
    if (debug) {
        System.out.println("Done verifyNamespaceProperties");
    }
    if (existingProperties == null) {
        throw new NamespaceNotCreatedException("No existing properties found");
    }
    return existingProperties.equals(nsProperties);
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceNotCreatedException(com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException)

Example 9 with NamespaceOptions

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

the class SilverKingClient method doGetNamespaceOptions.

private void doGetNamespaceOptions(String[] args) throws OperationException, IOException {
    String name;
    NamespaceOptions nsOptions;
    opMessage("Getting namespace options");
    name = args[0];
    nsOptions = null;
    sw.reset();
    for (int i = 0; i < reps; i++) {
        try {
            nsOptions = session.getNamespace(name).getOptions();
        } catch (NamespaceNotCreatedException nnce) {
            err.printf("No such namespace: %s\n", name);
        }
    }
    sw.stop();
    if (nsOptions != null) {
        out.println(nsOptions);
    }
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) NamespaceNotCreatedException(com.ms.silverking.cloud.dht.daemon.storage.NamespaceNotCreatedException) VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint)

Example 10 with NamespaceOptions

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

the class SilverKingClient method doCloneNamespace.

private void doCloneNamespace(String[] args) throws OperationException, IOException {
    String name;
    NamespaceOptions nsOptions;
    long version;
    nsOptions = syncNSP.getNamespace().getOptions();
    switch(nsOptions.getVersionMode()) {
        case SEQUENTIAL:
            System.out.println("clone currently not supported for NamespaceVersionMode.SEQUENTIAL");
            return;
        case CLIENT_SPECIFIED:
            if (args.length > 1) {
                version = Long.parseLong(args[1]);
            } else {
                version = System.currentTimeMillis();
                out.printf("No version specified. Using System.currentTimeMillis() %d %s\n", version, new Date(version).toString());
            }
            break;
        default:
            version = Long.MIN_VALUE;
            break;
    }
    name = args[0];
    out.println(version == Long.MIN_VALUE ? "No version passed" : "Passing version: " + version);
    opMessage("Cloning namespace");
    sw.reset();
    if (version == Long.MIN_VALUE) {
        syncNSP.getNamespace().clone(name);
    } else {
        syncNSP.getNamespace().clone(name, version);
    }
    sw.stop();
}
Also used : NamespaceOptions(com.ms.silverking.cloud.dht.NamespaceOptions) Date(java.util.Date)

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