use of com.ms.silverking.cloud.dht.NamespaceOptions in project SilverKing by Morgan-Stanley.
the class SilverKingClient method doCreateNamespace.
private void doCreateNamespace(String[] args) throws OperationException, IOException {
String name;
NamespaceOptions nsOptions;
name = args[0];
if (args.length > 1) {
nsOptions = NamespaceOptions.parse(args[1]);
} else {
nsOptions = null;
}
opMessage("Creating namespace");
if (verbose) {
System.out.printf("NamespaceOptions: %s\n", nsOptions);
}
sw.reset();
session.createNamespace(name, nsOptions);
sw.stop();
}
use of com.ms.silverking.cloud.dht.NamespaceOptions in project SilverKing by Morgan-Stanley.
the class SilverKingClient method doLinkToNamespace.
private void doLinkToNamespace(String[] args) throws OperationException, IOException {
String parent;
NamespaceOptions nsOptions;
nsOptions = syncNSP.getNamespace().getOptions();
switch(nsOptions.getVersionMode()) {
case SINGLE_VERSION:
break;
default:
System.out.println("linkToNamespace is only supported for NamespaceVersionMode.SINGLE_VERSION");
return;
}
parent = args[0];
opMessage("Linking namespace");
sw.reset();
syncNSP.getNamespace().linkTo(parent);
sw.stop();
}
use of com.ms.silverking.cloud.dht.NamespaceOptions in project SilverKing by Morgan-Stanley.
the class ClientTool method doCreateNamespace.
private void doCreateNamespace(ClientOptions options, DHTSession session, Stopwatch sw) throws OperationException, IOException {
long version;
NamespaceOptions nsOptions;
if (options.nsOptions != null) {
nsOptions = NamespaceOptions.parse(options.nsOptions);
} else {
nsOptions = null;
}
if (options.version > 0) {
version = options.version;
} else {
version = DHTUtil.currentTimeMillis();
}
Log.warning("Creating syncRequest");
sw.reset();
for (int i = 0; i < options.reps; i++) {
session.createNamespace(options.namespace, nsOptions);
}
sw.stop();
}
use of com.ms.silverking.cloud.dht.NamespaceOptions in project SilverKing by Morgan-Stanley.
the class SegmentDebug method main.
/**
* @param args
*/
public static void main(String[] args) {
try {
if (args.length != 2) {
System.out.println("args: <nsDir> <segmentNumber>");
} else {
File nsDir;
int segmentNumber;
NamespaceOptions nsOptions;
nsDir = new File(args[0]);
if (!nsDir.isDirectory()) {
throw new RuntimeException("Can't find nsDir: " + nsDir);
}
segmentNumber = Integer.parseInt(args[1]);
nsOptions = NamespacePropertiesIO.read(nsDir).getOptions();
System.out.println(nsOptions);
new SegmentDebug(nsDir).debug(segmentNumber, nsOptions);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.ms.silverking.cloud.dht.NamespaceOptions in project SilverKing by Morgan-Stanley.
the class FileSegmentRecoverer method readFullSegment.
void readFullSegment(int segmentNumber, SegmentIndexLocation segmentIndexLocation, SegmentPrereadMode segmentPrereadMode) {
Stopwatch sw;
Log.warning("Reading full segment: ", segmentNumber);
sw = new SimpleStopwatch();
try {
FileSegment segment;
NamespaceProperties nsProperties;
NamespaceOptions nsOptions;
// DataSegmentWalker dsWalker;
nsProperties = NamespacePropertiesIO.read(nsDir);
nsOptions = nsProperties.getOptions();
segment = FileSegment.openReadOnly(nsDir, segmentNumber, nsOptions.getSegmentSize(), nsOptions, segmentIndexLocation, segmentPrereadMode);
for (DHTKeyIntEntry entry : segment.getPKC()) {
int offset;
offset = entry.getValue();
if (offset < 0) {
OffsetList offsetList;
offsetList = segment.offsetListStore.getOffsetList(-offset);
for (int listOffset : offsetList) {
System.out.printf("%s\t%d\t%d\t%f\t*%d\t%d\n", entry, segment.getCreationTime(offset), segment.getVersion(listOffset), KeyUtil.keyEntropy(entry), offset, offsetList);
// nsStore.putSegmentNumberAndVersion(entry.getKey(), segmentNumber, segment.getVersion(listOffset));
}
} else {
System.out.printf("%s\t%d\t%d\t%f\t%d\n", entry, segment.getCreationTime(offset), segment.getVersion(offset), KeyUtil.keyEntropy(entry), offset);
// nsStore.putSegmentNumberAndVersion(entry.getKey(), segmentNumber, segment.getVersion(offset));
}
}
// dsWalker = new DataSegmentWalker(segment.dataBuf);
// for (DataSegmentWalkEntry entry : dsWalker) {
// nsStore.addToSizeStats(entry.getUncompressedLength(), entry.getCompressedLength());
// }
segment.close();
sw.stop();
Log.warning("Done reading full segment: ", segmentNumber + " " + sw);
} catch (IOException ioe) {
Log.logErrorWarning(ioe, "Unable to recover: " + segmentNumber);
}
}
Aggregations