new style resolve switch
This commit is contained in:
parent
772108ff12
commit
6326f965ab
1 changed files with 13 additions and 14 deletions
|
@ -1561,7 +1561,6 @@ final class RpcState<VatId> {
|
||||||
*/
|
*/
|
||||||
RpcPipeline(QuestionRef questionRef) {
|
RpcPipeline(QuestionRef questionRef) {
|
||||||
this(questionRef, null);
|
this(questionRef, null);
|
||||||
// TODO implement tail calls...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1569,30 +1568,30 @@ final class RpcState<VatId> {
|
||||||
// TODO avoid conversion to/from ArrayList?
|
// TODO avoid conversion to/from ArrayList?
|
||||||
var key = new ArrayList<>(Arrays.asList(ops));
|
var key = new ArrayList<>(Arrays.asList(ops));
|
||||||
|
|
||||||
var hook = this.clientMap.computeIfAbsent(key, k -> {
|
return this.clientMap.computeIfAbsent(key, k -> {
|
||||||
switch (state) {
|
return switch (state) {
|
||||||
case WAITING: {
|
case WAITING -> {
|
||||||
var pipelineClient = new PipelineClient(this.questionRef, ops);
|
var pipelineClient = new PipelineClient(this.questionRef, ops);
|
||||||
if (this.redirectLater == null) {
|
if (this.redirectLater == null) {
|
||||||
// This pipeline will never get redirected, so just return the PipelineClient.
|
// This pipeline will never get redirected, so just return the PipelineClient.
|
||||||
return pipelineClient;
|
yield pipelineClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert this.resolveSelf != null;
|
assert this.resolveSelf != null;
|
||||||
var resolutionPromise = this.resolveSelf.thenApply(
|
var resolutionPromise = this.resolveSelf.thenApply(
|
||||||
response -> response.getResults().getPipelinedCap(ops));
|
response -> response.getResults().getPipelinedCap(ops));
|
||||||
return new PromiseClient(pipelineClient, resolutionPromise, null);
|
yield new PromiseClient(pipelineClient, resolutionPromise, null);
|
||||||
}
|
}
|
||||||
|
case RESOLVED -> {
|
||||||
case RESOLVED:
|
|
||||||
assert this.resolved != null;
|
assert this.resolved != null;
|
||||||
return this.resolved.getResults().getPipelinedCap(ops);
|
yield this.resolved.getResults().getPipelinedCap(ops);
|
||||||
|
}
|
||||||
default:
|
case BROKEN -> {
|
||||||
return Capability.newBrokenCap(broken);
|
assert this.broken != null;
|
||||||
}
|
yield Capability.newBrokenCap(broken);
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
return hook;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue