use of com.ms.silverking.collection.Pair in project SilverKing by Morgan-Stanley.
the class DirectoryInMemorySS method serializeDir.
/*
public DirectoryInMemorySS(byte[] buf, int offset, int limit, SSStorageParameters storageParams) {
super(buf, offset, limit);
this.storageParams = storageParams;
}
*/
public Pair<SSStorageParameters, byte[]> serializeDir() {
byte[] serializedDir;
StorageParameters sp;
byte[] checksum;
serializedDir = serialize();
checksum = new byte[0];
sp = new StorageParameters(latestUpdateSP.getVersion(), serializedDir.length, serializedDir.length, CCSSUtil.createCCSS(Compression.NONE, ChecksumType.NONE), checksum, latestUpdateSP.getValueCreator(), latestUpdateSP.getCreationTime());
return new Pair<>(sp, serializedDir);
}
use of com.ms.silverking.collection.Pair in project SilverKing by Morgan-Stanley.
the class SystemNamespaceStore method getAllReplicasFreeSystemDiskBytesEstimate.
private byte[] getAllReplicasFreeSystemDiskBytesEstimate() {
List<Pair<IPAndPort, Long>> results;
Map<IPAndPort, NodeInfo> nodeInfo;
results = new ArrayList<>();
try {
nodeInfo = getAllNodeInfo();
for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
NodeInfo info;
info = nodeInfo.get(node);
if (info != null) {
long freeSystemBytesEstimate;
freeSystemBytesEstimate = (long) ((double) info.getFSFreeBytes() / ringMaster.getCurrentOwnedFraction(node, OwnerQueryMode.Primary));
results.add(new Pair<>(node, freeSystemBytesEstimate));
}
}
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
}
return pairedResultsToBytes(results);
}
use of com.ms.silverking.collection.Pair in project SilverKing by Morgan-Stanley.
the class SystemNamespaceStore method getAllReplicasFreeDiskBytes.
private byte[] getAllReplicasFreeDiskBytes() {
List<Pair<IPAndPort, Long>> results;
Map<IPAndPort, NodeInfo> nodeInfo;
results = new ArrayList<>();
try {
nodeInfo = getAllNodeInfo();
for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
NodeInfo info;
info = nodeInfo.get(node);
if (info != null) {
results.add(new Pair<>(node, info.getFSFreeBytes()));
}
}
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
}
return pairedResultsToBytes(results);
}
use of com.ms.silverking.collection.Pair in project SilverKing by Morgan-Stanley.
the class SKAdmin method _getActiveDaemons.
private Pair<Boolean, Set<IPAndPort>> _getActiveDaemons() {
try {
Set<IPAndPort> activeDaemons;
activeDaemons = suspectsZK.readActiveNodesFromZK();
for (IPAndPort daemon : activeDaemons) {
System.out.printf("%s\n", daemon.getIPAsString());
}
return new Pair<>(true, activeDaemons);
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
return new Pair(false, ImmutableSet.of());
}
}
use of com.ms.silverking.collection.Pair in project SilverKing by Morgan-Stanley.
the class SKAdmin method getRing.
private static Pair<RingConfiguration, InstantiatedRingTree> getRing(DHTConfiguration dhtConfig, com.ms.silverking.cloud.dht.meta.MetaClient dhtMC) throws IOException, KeeperException {
String ringName;
Pair<Long, Long> ringVersion;
DHTRingCurTargetZK dhtRingCurTargetZK;
Triple<String, Long, Long> curRingNameAndVersion;
RingConfiguration ringConfig;
RingConfigurationZK ringConfigZK;
InstantiatedRingTree ringTree;
com.ms.silverking.cloud.toporing.meta.MetaClient ringMC;
dhtRingCurTargetZK = new DHTRingCurTargetZK(dhtMC, dhtConfig);
curRingNameAndVersion = dhtRingCurTargetZK.getCurRingAndVersionPair();
if (curRingNameAndVersion == null) {
return null;
}
ringName = curRingNameAndVersion.getHead();
ringVersion = curRingNameAndVersion.getTail();
ringMC = com.ms.silverking.cloud.toporing.meta.MetaClient.createMetaClient(ringName, ringVersion.getV1(), dhtMC.getZooKeeper().getZKConfig());
ringConfigZK = new RingConfigurationZK(ringMC);
ringConfig = ringConfigZK.readFromZK(ringVersion.getV1(), null);
// ringTree = SingleRingZK.readTree(ringMC, ringVersion);
// FUTURE - think about whether or not we should keep this, currently unused
ringTree = null;
return new Pair<>(ringConfig, ringTree);
}
Aggregations