Search in sources :

Example 16 with NamespaceProperties

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

the class NamespacePropertiesIO method _write.

private static void _write(File nsDir, NamespaceProperties nsProperties, boolean allowRewrite) throws IOException {
    if (!nsDir.isDirectory()) {
        throw new IOException("NamespacePropertiesIO.write() passed non-directory: " + nsDir);
    }
    if (allowRewrite && propertiesFileExists(nsDir)) {
        propertiesFile(nsDir).delete();
    }
    if (propertiesFileExists(nsDir)) {
        NamespaceProperties existingProperties;
        existingProperties = read(nsDir);
        if (!nsProperties.equals(existingProperties)) {
            System.err.println(nsProperties);
            System.err.println(existingProperties);
            System.err.println();
            System.err.flush();
            System.out.println(nsProperties);
            System.out.println(existingProperties);
            System.out.println();
            System.out.flush();
            nsProperties.debugEquals(existingProperties);
            throw new RuntimeException("Existing properties != nsProperties");
        }
    } else {
        _write(propertiesFile(nsDir), nsProperties);
    }
}
Also used : NamespaceProperties(com.ms.silverking.cloud.dht.common.NamespaceProperties) IOException(java.io.IOException)

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