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);
}
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;
}
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);
}
}
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);
}
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();
}
}
Aggregations