use of com.ms.silverking.cloud.dht.common.KeyAndInteger in project SilverKing by Morgan-Stanley.
the class NamespaceStore method retrieve_nongroupedImpl.
public List<ByteBuffer> retrieve_nongroupedImpl(List<? extends DHTKey> keys, InternalRetrievalOptions options, UUIDBase opUUID) {
List<ByteBuffer> results;
KeyAndInteger[] _keys;
if (debugVersion) {
System.out.printf("retrieve internal options: %s\n", options);
}
results = new ArrayList<>(keys.size());
for (DHTKey key : keys) {
// for (KeyAndInteger key : _keys) {
ByteBuffer result;
/*
if (bufferGroup != null) {
result = bufferGroup[j];
} else {
result = null;
}
*/
if (retrieveTrigger != null) {
result = retrieveTrigger.retrieve(this, key, options);
} else {
result = _retrieve(key, options);
}
if (parent != null) {
VersionConstraint vc;
if (debugParent) {
Log.warning("parent != null");
}
vc = options.getVersionConstraint();
if (result == null) {
if (debugParent) {
Log.warningf("%x null result. Checking parent %x.", ns, parent.getNamespace());
}
// If result from this ns is null, look in the parent.
result = parent._retrieve(key, makeOptionsForNestedRetrieve(options));
if (debugParent) {
if (result != null) {
Log.warning("Found result in parent");
}
}
} else {
// Otherwise for the LEAST case, look in the parent to see if it has a better result.
if (vc.getMode() == VersionConstraint.Mode.LEAST) {
ByteBuffer parentResult;
if (debugParent) {
Log.warning("Non-null result, but mode LEAST. checking parent");
}
parentResult = parent._retrieve(key, makeOptionsForNestedRetrieve(options));
if (parentResult != null) {
// if the parent had any valid result, then - by virtue of the fact
// that all parent versions are < child versions - the parent
// result is preferred
result = parentResult;
if (result != null) {
Log.warning("Found result in parent");
}
}
}
}
}
if (result == null && options.getWaitMode() == WaitMode.WAIT_FOR && options.getVersionConstraint().getMax() > curSnapshot) {
// Note that since we hold the readLock, a write cannot come
// in while we add the pending wait for.
addPendingWaitFor(key, options.getRetrievalOptions(), opUUID);
}
if (options.getVerifyIntegrity()) {
result = verifyIntegrity(key, result);
}
results.add(result);
}
// }
return results;
}
Aggregations