implement bulk of pipelining logic

This commit is contained in:
Vaci Koblizek 2020-10-13 17:19:24 +01:00
parent c2f64ba317
commit dea4d2d3c0
27 changed files with 1095 additions and 509 deletions

View file

@ -1060,13 +1060,13 @@ private:
spaces(indent), " public void set", titleCase, "(", clientType, " value) {\n",
unionDiscrim.set,
spaces(indent), " _initPointerField(", factoryArg, ", ", offset, ", 0);\n",
spaces(indent), " _setPointerField(", factoryArg, ", ", offset, ", value);\n",
spaces(indent), " }\n",
"\n"),
kj::strTree(
spaces(indent), " public ", clientType, " get", titleCase, "() {\n",
spaces(indent), " return new ", clientType, "(typeless.getPointerField((short)", offset, ").asCap());\n",
spaces(indent), " return new ", clientType, "(this.getPointerField((short)", offset, ").asCap());\n",
spaces(indent), " }\n"
)
};
@ -1451,8 +1451,9 @@ private:
" new org.capnproto.StructSize((short)", structNode.getDataWordCount(),
",(short)", structNode.getPointerCount(), ");\n"),
spaces(indent), " public static final class Factory", factoryTypeParams,
" extends org.capnproto.StructFactory<Builder", builderTypeParams, ", Reader", readerTypeParams, "> {\n",
spaces(indent), " public static final class Factory", factoryTypeParams, "\n",
spaces(indent), " extends org.capnproto.StructFactory<Builder", builderTypeParams, ", Reader", readerTypeParams, ">\n",
spaces(indent), " implements org.capnproto.PipelineFactory<Pipeline> {\n",
factoryMembers.flatten(),
spaces(indent), " public Factory(",
factoryArgs.flatten(),
@ -1487,6 +1488,9 @@ private:
(hasTypeParams ? kj::strTree("this") : kj::strTree()),
");\n",
spaces(indent), " }\n",
spaces(indent), " public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {\n",
spaces(indent), " return new Pipeline(promise);\n",
spaces(indent), " }\n",
spaces(indent), " }\n",
(hasTypeParams ?
@ -1574,16 +1578,13 @@ private:
spaces(indent), " }\n"),
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
spaces(indent), " public static class Pipeline {\n",
spaces(indent), " private org.capnproto.AnyPointer.Pipeline typeless;\n\n",
spaces(indent), " public Pipeline() {}\n",
spaces(indent), " public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {\n",
spaces(indent), " this.typeless = typeless;\n",
spaces(indent), " public static class Pipeline extends org.capnproto.Pipeline<Reader> {\n",
spaces(indent), " public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {\n",
spaces(indent), " super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));\n",
spaces(indent), " }\n",
KJ_MAP(f, fieldTexts) { return kj::mv(f.pipelineMethodDecls); },
spaces(indent), " }\n",
spaces(indent), "}\n",
"\n",
"\n"),
kj::strTree(),
@ -1618,18 +1619,21 @@ private:
spaces(indent), " return new Client(hook);\n",
spaces(indent), " }\n",
spaces(indent), " }\n",
"\n",
spaces(indent), " public static final Factory factory = new Factory();\n",
"\n",
spaces(indent), " public static class Client extends org.capnproto.Capability.Client {\n",
spaces(indent), " public Client() {}\n",
spaces(indent), " public Client(org.capnproto.ClientHook hook) { super(hook); }\n",
spaces(indent), " public Client(org.capnproto.Capability.Client cap) { super(cap.getHook()); }\n",
spaces(indent), " public Client(org.capnproto.Capability.Client cap) { super(cap); }\n",
spaces(indent), " public Client(Server server) { super(server); }\n",
spaces(indent), " public Client(java.util.concurrent.CompletableFuture<org.capnproto.ClientHook> promise) {\n",
spaces(indent), " public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {\n",
spaces(indent), " super(promise);\n",
spaces(indent), " }\n",
spaces(indent), "\n",
"\n",
KJ_MAP(m, methods) { return kj::mv(m.clientDefs); },
spaces(indent), " }\n",
"\n",
spaces(indent), " public static abstract class Server extends org.capnproto.Capability.Server {\n",
spaces(indent), " protected org.capnproto.DispatchCallResult dispatchCall(\n",
spaces(indent), " long interfaceId, short methodId,\n",
@ -1640,7 +1644,7 @@ private:
spaces(indent), " return org.capnproto.Capability.Server.result(\n",
spaces(indent), " org.capnproto.Capability.Server.internalUnimplemented(\"", name, "\", interfaceId));\n",
spaces(indent), " }\n",
spaces(indent), "\n",
"\n",
spaces(indent), " protected org.capnproto.DispatchCallResult dispatchCallInternal(short methodId, org.capnproto.CallContext<org.capnproto.AnyPointer.Reader, org.capnproto.AnyPointer.Builder> context) {\n",
spaces(indent), " switch (methodId) {\n",
KJ_MAP(m, methods) { return kj::mv(m.dispatchCase); },
@ -1653,9 +1657,9 @@ private:
spaces(indent), " }\n",
spaces(indent), "\n",
KJ_MAP(n, nestedTypeDecls) { return kj::mv(n); },
spaces(indent), "\n",
"\n",
spaces(indent), "}\n",
spaces(indent), "\n")
"\n")
};
}
@ -1771,8 +1775,8 @@ private:
return MethodText {
kj::strTree(
" public org.capnproto.Request<", shortParamType, ".Builder, ", shortResultType, ".Reader> ", methodName, "Request() {\n",
" return newCall(", paramFactory, ", ", resultFactory, ", 0x", interfaceIdHex, "L, (short)", methodId, ");\n"
" public org.capnproto.Request<", shortParamType, ".Builder, ", shortResultType, ".Pipeline> ", methodName, "Request() {\n",
" return newCall(", paramFactory, ", ", shortResultType, ".factory, 0x", interfaceIdHex, "L, (short)", methodId, ");\n"
" }\n"),
kj::strTree(

View file

@ -22,7 +22,9 @@
package org.capnproto;
public final class AnyPointer {
public static final class Factory implements PointerFactory<Builder, Reader> {
public static final class Factory
implements PointerFactory<Builder, Reader>,
PipelineFactory<Pipeline> {
public final Reader fromPointerReader(SegmentReader segment, CapTableReader capTable, int pointer, int nestingLimit) {
return new Reader(segment, capTable, pointer, nestingLimit);
}
@ -34,6 +36,9 @@ public final class AnyPointer {
result.clear();
return result;
}
public Pipeline newPipeline(RemotePromise<Reader> promise) {
return new AnyPointer.Pipeline(promise);
}
}
public static final Factory factory = new Factory();
@ -70,18 +75,21 @@ public final class AnyPointer {
}
public final ClientHook getPipelinedCap(PipelineOp[] ops) {
AnyPointer.Reader any = this;
for (var op: ops) {
switch (op.type) {
case NOOP:
break;
case GET_POINTER_FIELD:
var index = op.pointerIndex;
var reader = WireHelpers.readStructPointer(any.segment, any.capTable, any.pointer, null, 0, any.nestingLimit);
// TODO getpointerfield
any = reader._getPointerField(AnyPointer.factory, op.pointerIndex);
break;
}
}
// TODO implement getPipelinedCap
return null;
return WireHelpers.readCapabilityPointer(any.segment, any.capTable, any.pointer, 0);
}
}
@ -124,12 +132,13 @@ public final class AnyPointer {
factory.setPointerBuilder(this.segment, this.capTable, this.pointer, reader);
}
public final Capability.Client getAsCap() {
/*
final Capability.Client getAsCap() {
return new Capability.Client(
WireHelpers.readCapabilityPointer(this.segment, capTable, this.pointer, 0));
}
public final void setAsCap(Capability.Client cap) {
*/
final void setAsCap(Capability.Client cap) {
WireHelpers.setCapabilityPointer(this.segment, capTable, this.pointer, cap.hook);
}
@ -143,46 +152,15 @@ public final class AnyPointer {
}
}
public static final class Pipeline {
private PipelineHook hook;
private final PipelineOp[] ops;
public static final class Pipeline
extends org.capnproto.Pipeline<AnyPointer.Reader> {
Pipeline() {
this.hook = null;
this.ops = new PipelineOp[0];
public Pipeline(RemotePromise<AnyPointer.Reader> promise) {
super(promise);
}
Pipeline(PipelineHook hook) {
this.hook = hook;
this.ops = new PipelineOp[0];
}
Pipeline(PipelineHook hook, PipelineOp[] ops) {
this.hook = hook;
this.ops = ops;
}
Pipeline noop() {
return new Pipeline(this.hook, this.ops.clone());
}
public ClientHook asCap() {
return this.hook.getPipelinedCap(this.ops);
}
PipelineHook releasePipelineHook() {
var tmp = this.hook;
this.hook = null;
return tmp;
}
public Pipeline getPointerField(short pointerIndex) {
var newOps = new PipelineOp[this.ops.length+1];
for (int ii = 0; ii < this.ops.length; ++ii) {
newOps[ii] = this.ops[ii];
}
newOps[this.ops.length] = PipelineOp.PointerField(pointerIndex);
return new Pipeline(this.hook, newOps);
public Pipeline(RemotePromise<AnyPointer.Reader> promise, PipelineOp[] ops) {
super(promise, ops);
}
}
}

View file

@ -32,8 +32,8 @@ public class CallContext<Params, Results> {
return this.hook.getResults().initAs(results);
}
public final <SubParams> CompletableFuture<java.lang.Void> tailCall(Request<SubParams, Results> tailRequest) {
return hook.tailCall(tailRequest.hook);
public final <SubParams, Results> CompletableFuture<java.lang.Void> tailCall(Request<SubParams, Results> tailRequest) {
return hook.tailCall(tailRequest.getHook());
}
public final void allowCancellation() {

View file

@ -1,6 +1,7 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
public final class Capability {
@ -12,28 +13,35 @@ public final class Capability {
CapTableReader capTable;
}
public static abstract class Factory<T>
public static abstract class Factory<T extends Client>
implements FromPointerReader<T>,
FromPointerBuilder<T> {
FromPointerBuilder<T>,
SetPointerBuilder<T, T> {
public abstract T newClient(ClientHook hook);
@Override
public T fromPointerReader(SegmentReader segment, CapTableReader capTable, int pointer, int nestingLimit) {
var hook = WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0);
return newClient(hook);
return newClient(
WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0));
}
@Override
public T fromPointerBuilder(SegmentBuilder segment, CapTableBuilder capTable, int pointer) {
var hook = WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0);
return newClient(hook);
return newClient(
WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0));
}
@Override
public T initFromPointerBuilder(SegmentBuilder segment, CapTableBuilder capTable, int pointer, int elementCount) {
var hook = WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0);
return newClient(hook);
return newClient(
WireHelpers.readCapabilityPointer(segment, capTable, pointer, 0));
}
public abstract T newClient(ClientHook hook);
@Override
public void setPointerBuilder(SegmentBuilder segment, CapTableBuilder capTable, int pointer, T value) {
WireHelpers.setCapabilityPointer(segment, capTable, pointer, value.getHook());
}
}
public static class Client {
@ -44,6 +52,10 @@ public final class Capability {
this.hook = null;
}
public Client(Client other) {
this.hook = other.hook;
}
public Client(ClientHook hook) {
this.hook = hook;
}
@ -52,15 +64,16 @@ public final class Capability {
this(makeLocalClient(server));
}
public Client(CompletableFuture<ClientHook> promise) {
this(Capability.newLocalPromiseClient(promise));
public <T extends Client> Client(CompletionStage<T> promise) {
this(Capability.newLocalPromiseClient(
promise.thenApply(client -> client.getHook())));
}
public Client(Throwable exc) {
this(newBrokenCap(exc));
}
public ClientHook getHook() {
ClientHook getHook() {
return this.hook;
}
@ -68,27 +81,20 @@ public final class Capability {
return server.makeLocalClient();
}
CompletableFuture<?> whenResolved() {
return hook.whenResolved();
CompletionStage<?> whenResolved() {
return this.hook.whenResolved();
}
Request<AnyPointer.Builder, AnyPointer.Reader> typelessRequest(
long interfaceId,
short methodId) {
return hook.newCall(interfaceId, methodId);
protected <P, R> Request<P, R> newCall(FromPointerBuilder<P> paramsFactory,
PipelineFactory<R> pipelineFactory,
long interfaceId, short methodId) {
return Request.fromTypeless(paramsFactory, pipelineFactory, hook.newCall(interfaceId, methodId));
}
protected <T, U> Request<T, U> newCall(FromPointerBuilder<T> builder,
FromPointerReader<U> reader,
protected <T> StreamingRequest<T> newStreamingCall(FromPointerBuilder<T> paramsBuilder,
long interfaceId, short methodId) {
var request = hook.newCall(interfaceId, methodId);
return new Request<> (builder, reader, request.params, request.hook);
}
protected <T> StreamingRequest<T> newStreamingCall(FromPointerBuilder<T> builder,
long interfaceId, short methodId) {
var request = hook.newCall(interfaceId, methodId);
return new StreamingRequest<> (builder, request.params, request.hook);
return new StreamingRequest<> (paramsBuilder, request.params, request.hook);
}
}
@ -114,10 +120,10 @@ public final class Capability {
}
@Override
public Request<AnyPointer.Builder, AnyPointer.Reader> newCall(long interfaceId, short methodId) {
public Request<AnyPointer.Builder, AnyPointer.Pipeline> newCall(long interfaceId, short methodId) {
var hook = new LocalRequest(interfaceId, methodId, this);
var root = hook.message.getRoot(AnyPointer.factory);
return new Request<>(AnyPointer.factory, AnyPointer.factory, root, hook);
return new Request<>(root, AnyPointer.factory, hook);
}
@Override
@ -236,11 +242,11 @@ public final class Capability {
}
}
public static ClientHook newLocalPromiseClient(CompletableFuture<ClientHook> promise) {
public static ClientHook newLocalPromiseClient(CompletionStage<ClientHook> promise) {
return new QueuedClient(promise);
}
public static PipelineHook newLocalPromisePipeline(CompletableFuture<PipelineHook> promise) {
public static PipelineHook newLocalPromisePipeline(CompletionStage<PipelineHook> promise) {
return new QueuedPipeline(promise);
}
@ -267,6 +273,7 @@ public final class Capability {
return context.response;
});
assert promiseAndPipeline.pipeline != null;
return new RemotePromise<>(promise, promiseAndPipeline.pipeline);
}
@ -274,7 +281,7 @@ public final class Capability {
public CompletableFuture<?> sendStreaming() {
// We don't do any special handling of streaming in RequestHook for local requests, because
// there is no latency to compensate for between the client and server in this case.
return send().ignoreResult();
return send();
}
@Override
@ -333,10 +340,7 @@ public final class Capability {
if (this.response == null) {
var localResponse = new LocalResponse();
this.responseBuilder = localResponse.message.getRoot(AnyPointer.factory);
this.response = new Response<>(
AnyPointer.factory,
this.responseBuilder.asReader(),
localResponse);
this.response = new Response<>(this.responseBuilder.asReader(), localResponse);
}
return this.responseBuilder;
}
@ -384,7 +388,7 @@ public final class Capability {
static private ClientHook newBrokenClient(Throwable exc, boolean resolved, Object brand) {
return new ClientHook() {
@Override
public Request<AnyPointer.Builder, AnyPointer.Reader> newCall(long interfaceId, short methodId) {
public Request<AnyPointer.Builder, AnyPointer.Pipeline> newCall(long interfaceId, short methodId) {
return Request.newBrokenRequest(exc);
}
@ -394,12 +398,8 @@ public final class Capability {
}
@Override
public CompletableFuture<ClientHook> whenMoreResolved() {
if (resolved) {
return null;
} else {
return CompletableFuture.failedFuture(exc);
}
public CompletionStage<ClientHook> whenMoreResolved() {
return resolved ? null : CompletableFuture.failedFuture(exc);
}
@Override

View file

@ -1,13 +1,14 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
public interface ClientHook {
Object NULL_CAPABILITY_BRAND = new Object();
Object BROKEN_CAPABILITY_BRAND = new Object();
Request<AnyPointer.Builder, AnyPointer.Reader> newCall(long interfaceId, short methodId);
Request<AnyPointer.Builder, AnyPointer.Pipeline> newCall(long interfaceId, short methodId);
VoidPromiseAndPipeline call(long interfaceId, short methodId, CallContextHook context);
@ -15,7 +16,7 @@ public interface ClientHook {
return null;
}
default CompletableFuture<ClientHook> whenMoreResolved() {
default CompletionStage<ClientHook> whenMoreResolved() {
return null;
}
@ -23,7 +24,7 @@ public interface ClientHook {
return NULL_CAPABILITY_BRAND;
}
default CompletableFuture<java.lang.Void> whenResolved() {
default CompletionStage<?> whenResolved() {
var promise = whenMoreResolved();
return promise != null
? promise.thenCompose(ClientHook::whenResolved)
@ -43,10 +44,10 @@ public interface ClientHook {
}
final class VoidPromiseAndPipeline {
public final CompletableFuture<?> promise;
public final CompletionStage<?> promise;
public final PipelineHook pipeline;
VoidPromiseAndPipeline(CompletableFuture<?> promise, PipelineHook pipeline) {
VoidPromiseAndPipeline(CompletionStage<?> promise, PipelineHook pipeline) {
this.promise = promise;
this.pipeline = pipeline;
}

View file

@ -0,0 +1,18 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
public class CompletableFutureWrapper<T> extends CompletableFuture<T> {
public CompletableFutureWrapper(CompletionStage<T> other) {
other.toCompletableFuture().whenComplete((value, exc) -> {
if (exc == null) {
this.complete(value);
}
else {
this.completeExceptionally(exc);
}
});
}
}

View file

@ -0,0 +1,41 @@
package org.capnproto;
public class Pipeline<Results>
extends RemotePromise<Results> {
protected final PipelineOp[] ops;
protected PipelineHook hook;
public Pipeline(RemotePromise<Results> remotePromise) {
this(remotePromise, new PipelineOp[0]);
}
public Pipeline(RemotePromise<Results> remotePromise, PipelineOp[] ops) {
super(remotePromise.response, remotePromise.hook);
this.ops = ops;
this.hook = remotePromise.hook;
}
public PipelineHook getHook() {
return hook;
}
Pipeline<Results> noop() {
return new Pipeline<>(this, this.ops.clone());
}
public ClientHook asCap() {
return this.hook.getPipelinedCap(this.ops);
}
public Pipeline<Results> getPointerField(short pointerIndex) {
var newOps = new PipelineOp[this.ops.length+1];
for (int ii = 0; ii < this.ops.length; ++ii) {
newOps[ii] = this.ops[ii];
}
newOps[this.ops.length] = PipelineOp.PointerField(pointerIndex);
return new Pipeline<>(this, newOps);
}
}

View file

@ -0,0 +1,5 @@
package org.capnproto;
public interface PipelineFactory<Pipeline> {
Pipeline newPipeline(RemotePromise<AnyPointer.Reader> promise);
}

View file

@ -1,6 +1,6 @@
package org.capnproto;
interface PipelineHook {
public interface PipelineHook {
ClientHook getPipelinedCap(PipelineOp[] ops);

View file

@ -2,6 +2,8 @@ package org.capnproto;
final class PipelineOp {
// TODO just use array of Short?
enum Type {
NOOP,
GET_POINTER_FIELD
@ -44,7 +46,7 @@ final class PipelineOp {
var transform = transforms.get(ii);
switch (transform.which()) {
case NOOP:
ops[ii] = Noop();
ops[ii] = Noop(); // TODO null?
break;
case GET_POINTER_FIELD:
ops[ii] = PointerField(transform.getGetPointerField());

View file

@ -1,20 +1,20 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
class QueuedClient implements ClientHook {
final CompletableFuture<ClientHook> promise;
final CompletableFuture<ClientHook> promiseForCallForwarding;
final CompletableFuture<ClientHook> promiseForClientResolution;
final CompletableFuture<java.lang.Void> setResolutionOp;
final CompletionStage<ClientHook> promise;
final CompletionStage<ClientHook> promiseForCallForwarding;
final CompletionStage<ClientHook> promiseForClientResolution;
final CompletionStage<java.lang.Void> setResolutionOp;
ClientHook redirect;
QueuedClient(CompletableFuture<ClientHook> promise) {
QueuedClient(CompletionStage<ClientHook> promise) {
// TODO revisit futures
this.promise = promise.copy();
this.promiseForCallForwarding = promise.copy();
this.promiseForClientResolution = promise.copy();
this.promise = promise.toCompletableFuture().copy();
this.promiseForCallForwarding = promise.toCompletableFuture().copy();
this.promiseForClientResolution = promise.toCompletableFuture().copy();
this.setResolutionOp = promise.thenAccept(inner -> {
this.redirect = inner;
}).exceptionally(exc -> {
@ -24,15 +24,18 @@ class QueuedClient implements ClientHook {
}
@Override
public Request<AnyPointer.Builder, AnyPointer.Reader> newCall(long interfaceId, short methodId) {
public Request<AnyPointer.Builder, AnyPointer.Pipeline> newCall(long interfaceId, short methodId) {
var hook = new Capability.LocalRequest(interfaceId, methodId, this);
var root = hook.message.getRoot(AnyPointer.factory);
return new Request<>(AnyPointer.factory, AnyPointer.factory, root, hook);
return new Request<>(root, AnyPointer.factory, hook);
}
@Override
public VoidPromiseAndPipeline call(long interfaceId, short methodId, CallContextHook ctx) {
return null;
var callResultPromise = this.promiseForCallForwarding.thenApply(client -> client.call(interfaceId, methodId, ctx));
var pipelinePromise = callResultPromise.thenApply(callResult -> callResult.pipeline);
var pipeline = new QueuedPipeline(pipelinePromise);
return new VoidPromiseAndPipeline(callResultPromise, pipeline);
}
@Override
@ -41,7 +44,7 @@ class QueuedClient implements ClientHook {
}
@Override
public CompletableFuture<ClientHook> whenMoreResolved() {
public CompletionStage<ClientHook> whenMoreResolved() {
return promiseForClientResolution;
}
}

View file

@ -1,15 +1,15 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
final class QueuedPipeline implements PipelineHook {
final CompletableFuture<PipelineHook> promise;
final CompletableFuture<Void> selfResolutionOp;
final CompletionStage<PipelineHook> promise;
final CompletionStage<Void> selfResolutionOp;
PipelineHook redirect;
public QueuedPipeline(CompletableFuture<PipelineHook> promiseParam) {
this.promise = promiseParam.copy();
public QueuedPipeline(CompletionStage<PipelineHook> promiseParam) {
this.promise = promiseParam;
this.selfResolutionOp = promise.handle((pipeline, exc) -> {
this.redirect = exc == null
? pipeline

View file

@ -1,29 +1,26 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
class RemotePromise<Results> {
public class RemotePromise<Results>
extends CompletableFutureWrapper<Results> {
final CompletableFuture<Response<Results>> response;
final PipelineHook pipeline;
final CompletionStage<Response<Results>> response;
final PipelineHook hook;
RemotePromise(CompletableFuture<Response<Results>> response,
PipelineHook pipeline) {
this.response = response;
this.pipeline = pipeline;
RemotePromise(CompletionStage<Response<Results>> promise,
PipelineHook hook) {
super(promise.thenApply(response -> response.getResults()));
this.response = promise;
this.hook = hook;
}
public CompletableFuture<Response<Results>> getResponse() {
return response;
}
public CompletableFuture<?> ignoreResult() {
return this.response.thenCompose(
result -> CompletableFuture.completedFuture(null));
}
public PipelineHook getHook() {
return pipeline;
public static <R> RemotePromise<R> fromTypeless(
FromPointerReader<R> resultsFactory,
RemotePromise<AnyPointer.Reader> typeless) {
var promise = typeless.response.thenApply(
response -> Response.fromTypeless(resultsFactory, response));
return new RemotePromise<>(promise, typeless.hook);
}
}

View file

@ -4,38 +4,33 @@ import java.util.concurrent.CompletableFuture;
public class Request<Params, Results> {
AnyPointer.Builder params;
private final FromPointerBuilder<Params> paramsBuilder;
private final FromPointerReader<Results> resultsReader;
Params params;
PipelineFactory<Results> pipelineFactory;
RequestHook hook;
Request(FromPointerBuilder<Params> paramsBuilder,
FromPointerReader<Results> resultsReader,
AnyPointer.Builder params, RequestHook hook) {
this.paramsBuilder = paramsBuilder;
this.resultsReader = resultsReader;
public Request(Params params,
PipelineFactory<Results> pipelineFactory,
RequestHook hook) {
this.params = params;
this.pipelineFactory = pipelineFactory;
this.hook = hook;
}
Params params() {
return params.getAs(paramsBuilder);
public Params getParams() {
return params;
}
RemotePromise<Results> send() {
var typelessPromise = hook.send();
hook = null; // prevent reuse
var typedPromise = typelessPromise.getResponse().thenApply(response -> {
return new Response<Results>(
resultsReader,
response.getResults(),
response.hook);
});
return new RemotePromise<Results>(typedPromise, typelessPromise.pipeline);
public RequestHook getHook() {
return this.hook;
}
static <T, U> Request<T, U> newBrokenRequest(Throwable exc) {
public Results send() {
var typelessPromise = this.hook.send();
this.hook = null; // prevent reuse
return pipelineFactory.newPipeline(typelessPromise);
}
static <P, R> Request<P, R> newBrokenRequest(Throwable exc) {
final MessageBuilder message = new MessageBuilder();
var hook = new RequestHook() {
@ -56,16 +51,13 @@ public class Request<Params, Results> {
};
var root = message.getRoot(AnyPointer.factory);
return new Request<T, U>(null, null, root, hook);
return new Request<P, R>(null, null, hook);
}
static Request<AnyPointer.Builder, AnyPointer.Reader> newTypelessRequest(AnyPointer.Builder root, RequestHook hook) {
return new Request<>(AnyPointer.factory, AnyPointer.factory, root, hook);
}
static <Params, Results> Request<Params, Results> fromTypeless(FromPointerBuilder<Params> params,
FromPointerReader<Results> results,
Request<AnyPointer.Builder, AnyPointer.Reader> typeless) {
return new Request<>(params, results, typeless.params(), typeless.hook);
static <P, R> Request<P, R> fromTypeless(
FromPointerBuilder<P> paramsFactory,
PipelineFactory<R> pipelineFactory,
Request<AnyPointer.Builder, AnyPointer.Pipeline> typeless) {
return new Request<>(typeless.params.getAs(paramsFactory), pipelineFactory, typeless.hook);
}
}

View file

@ -1,9 +1,9 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
public interface RequestHook {
RemotePromise<AnyPointer.Reader> send();
CompletableFuture<?> sendStreaming();
CompletionStage<?> sendStreaming();
Object getBrand();
}

View file

@ -1,20 +1,27 @@
package org.capnproto;
class Response<Results> {
public class Response<Results> {
final FromPointerReader<Results> factory;
final ResponseHook hook;
final AnyPointer.Reader results;
private Results results;
private ResponseHook hook;
public Response(FromPointerReader<Results> factory,
AnyPointer.Reader reader,
public Response(Results results,
ResponseHook hook) {
this.factory = factory;
this.results = results;
this.hook = hook;
this.results = reader;
}
public final Results getResults() {
return this.results.getAs(factory);
public Results getResults() {
return this.results;
}
public ResponseHook getHook() {
return this.hook;
}
static <R> Response<R> fromTypeless(FromPointerReader<R> resultsFactory,
Response<AnyPointer.Reader> typeless) {
return new Response<>(typeless.getResults().getAs(resultsFactory), typeless.hook);
}
}

View file

@ -1,4 +1,4 @@
package org.capnproto;
interface ResponseHook {
public interface ResponseHook {
}

View file

@ -4,13 +4,12 @@ import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.FutureTask;
import java.util.function.Function;
final class RpcState {
static final class Question {
final int id;
CompletableFuture<RpcResponse> response = new CompletableFuture<>();
List<Integer> paramExports;
boolean isAwaitingReturn = false;
boolean isTailCall = false;
@ -20,10 +19,8 @@ final class RpcState {
this.id = id;
}
CompletableFuture<RpcResponse> response = new CompletableFuture<>();
void reject(Throwable exc) {
response.completeExceptionally(exc);
this.response.completeExceptionally(exc);
}
void answer(RpcResponse response) {
@ -34,7 +31,7 @@ final class RpcState {
static final class Answer {
boolean active = false;
PipelineHook pipeline;
CompletableFuture<RpcResponse> redirectedResults;
CompletionStage<RpcResponse> redirectedResults;
RpcCallContext callContext;
List<Integer> resultExports;
}
@ -239,21 +236,19 @@ final class RpcState {
case CAP:
var cap = resolve.getCap();
switch (cap.which()) {
case NONE:
break;
case SENDER_HOSTED:
releaseExport(cap.getSenderHosted(), 1);
break;
case SENDER_PROMISE:
releaseExport(cap.getSenderPromise(), 1);
break;
case RECEIVER_ANSWER:
break;
case RECEIVER_HOSTED:
break;
case THIRD_PARTY_HOSTED:
releaseExport(cap.getThirdPartyHosted().getVineId(), 1);
break;
case NONE:
case RECEIVER_ANSWER:
case RECEIVER_HOSTED:
break;
}
break;
case EXCEPTION:
@ -278,7 +273,7 @@ final class RpcState {
var answerId = bootstrap.getQuestionId();
var answer = answers.put(answerId);
if (answer.active) {
// questionId already in use
assert false: "questionId is already in use: " + answerId;
return;
}
answer.active = true;
@ -449,7 +444,7 @@ final class RpcState {
if (answer.redirectedResults == null) {
return;
}
question.response = answer.redirectedResults;
question.response = answer.redirectedResults.toCompletableFuture();
answer.redirectedResults = null;
break;
default:
@ -1214,7 +1209,7 @@ final class RpcState {
}
@Override
public Request<AnyPointer.Builder, AnyPointer.Reader> newCall(long interfaceId, short methodId) {
public Request<AnyPointer.Builder, AnyPointer.Pipeline> newCall(long interfaceId, short methodId) {
return newCallNoIntercept(interfaceId, methodId);
}
@ -1235,7 +1230,7 @@ final class RpcState {
return RpcState.this;
}
private Request<AnyPointer.Builder, AnyPointer.Reader> newCallNoIntercept(long interfaceId, short methodId) {
private Request<AnyPointer.Builder, AnyPointer.Pipeline> newCallNoIntercept(long interfaceId, short methodId) {
if (isDisconnected()) {
return Request.newBrokenRequest(disconnected);
}
@ -1245,7 +1240,7 @@ final class RpcState {
callBuilder.setInterfaceId(interfaceId);
callBuilder.setMethodId(methodId);
var root = request.getRoot();
return Request.newTypelessRequest(root, request);
return new Request<>(root, AnyPointer.factory, request);
}
}
@ -1290,18 +1285,16 @@ final class RpcState {
// The pipeline must get notified of resolution before the app does to maintain ordering.
var pipeline = new RpcPipeline(question, question.response);
var appPromise = question.response.thenApply(response -> {
var results = response.getResults();
return new Response<>(AnyPointer.factory, results, response);
var appPromise = question.response.thenApply(hook -> {
return new Response<>(hook.getResults(), hook);
});
return new RemotePromise<>(appPromise, pipeline);
}
@Override
public CompletableFuture<?> sendStreaming() {
public CompletionStage<?> sendStreaming() {
// TODO falling back to regular send for now...
return send().ignoreResult();
return send();
}
Question sendInternal(boolean isTailCall) {
@ -1407,7 +1400,7 @@ final class RpcState {
}
@Override
public CompletableFuture<ClientHook> whenMoreResolved() {
public CompletionStage<ClientHook> whenMoreResolved() {
return null;
}
}
@ -1556,7 +1549,7 @@ final class RpcState {
}
@Override
public CompletableFuture<ClientHook> whenMoreResolved() {
public CompletionStage<ClientHook> whenMoreResolved() {
return null;
}

View file

@ -2,6 +2,7 @@ package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
public class StreamingRequest<Params> {
@ -16,7 +17,7 @@ public class StreamingRequest<Params> {
this.hook = hook;
}
CompletableFuture<?> send() {
CompletionStage<?> send() {
var promise = hook.sendStreaming();
hook = null; // prevent reuse
return promise;

View file

@ -64,10 +64,17 @@ public class StructReader extends Capability.ReaderContext {
this.nestingLimit = nestingLimit;
}
final StructReader imbue(CapTableReader capTable) {
var result = new StructReader(segment, data, pointers, dataSize, pointerCount, nestingLimit);
result.capTable = capTable;
return result;
public StructReader(SegmentReader segment, CapTableReader capTable,
int data,
int pointers, int dataSize, short pointerCount,
int nestingLimit) {
this.segment = segment;
this.data = data;
this.pointers = pointers;
this.dataSize = dataSize;
this.pointerCount = pointerCount;
this.nestingLimit = nestingLimit;
this.capTable = capTable;
}
protected final boolean _getBooleanField(int offset) {

View file

@ -1,14 +1,11 @@
package org.capnproto;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
public interface VatNetwork<VatId> {
interface Connection {
OutgoingRpcMessage newOutgoingMessage(int firstSegmentWordSize);
CompletableFuture<IncomingRpcMessage> receiveIncomingMessage();
}

View file

@ -956,6 +956,48 @@ final class WireHelpers {
}
static StructReader readStructPointer(SegmentReader segment,
CapTableReader capTable,
int refOffset,
SegmentReader defaultSegment,
int defaultOffset,
int nestingLimit) {
long ref = segment.get(refOffset);
if (WirePointer.isNull(ref)) {
if (defaultSegment == null) {
return new StructReader(SegmentReader.EMPTY, 0, 0, 0, (short) 0, 0x7fffffff);
} else {
segment = defaultSegment;
refOffset = defaultOffset;
ref = segment.get(refOffset);
}
}
if (nestingLimit <= 0) {
throw new DecodeException("Message is too deeply nested or contains cycles.");
}
int refTarget = WirePointer.target(refOffset, ref);
FollowFarsResult resolved = followFars(ref, refTarget, segment);
int dataSizeWords = StructPointer.dataSize(resolved.ref);
if (WirePointer.kind(resolved.ref) != WirePointer.STRUCT) {
throw new DecodeException("Message contains non-struct pointer where struct pointer was expected.");
}
resolved.segment.arena.checkReadLimit(StructPointer.wordSize(resolved.ref));
return new StructReader(resolved.segment,
capTable,
resolved.ptr * Constants.BYTES_PER_WORD,
(resolved.ptr + dataSizeWords),
dataSizeWords * Constants.BITS_PER_WORD,
StructPointer.ptrCount(resolved.ref),
nestingLimit - 1);
}
static SegmentBuilder setStructPointer(SegmentBuilder segment, CapTableBuilder capTable, int refOffset, StructReader value) {
short dataSize = (short)roundBitsUpToWords(value.dataSize);
int totalSize = dataSize + value.pointerCount * Constants.POINTER_SIZE_IN_WORDS;
@ -1377,7 +1419,8 @@ final class WireHelpers {
return Capability.newBrokenCap("Cannot read capability pointer without capTable.");
}
var cap = capTable.extractCap(WirePointer.upper32Bits(ref));
int index = WirePointer.upper32Bits(ref);
var cap = capTable.extractCap(index);
if (cap == null) {
return Capability.newBrokenCap("Calling invalid capability pointer.");
}

View file

@ -11,91 +11,10 @@ import java.nio.channels.AsynchronousSocketChannel;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
class TestCap0 {
class TestCap0Impl extends Demo.TestCap0.Server {
static final class Client extends org.capnproto.Capability.Client {
public Client() { super(); }
public Client(ClientHook hook) { super(hook); }
public Client(Capability.Client cap) { super(cap.hook); }
public Client(Capability.Server server) { super(server); }
public org.capnproto.Request<Demo.TestParams0.Builder, Demo.TestResults0.Reader> testMethod0Request() {
return newCall(Demo.TestParams0.factory, Demo.TestResults0.factory, 0xa65f4a3d7f622e6bL, (short) 0);
}
public org.capnproto.Request<Demo.TestParams1.Builder, Demo.TestResults1.Reader> testMethod1Request() {
return newCall(Demo.TestParams1.factory, Demo.TestResults1.factory, 0xa65f4a3d7f622e6bL, (short) 1);
}
}
public static class Server extends Capability.Server {
@Override
public DispatchCallResult dispatchCall(long interfaceId, short methodId, CallContext<AnyPointer.Reader, AnyPointer.Builder> context) {
if (interfaceId == 0xa65f4a3d7f622e6bL) {
return dispatchCallInternal(methodId, context);
}
return result(internalUnimplemented(Demo.class.getName(), interfaceId));
}
DispatchCallResult dispatchCallInternal(short methodId, CallContext<AnyPointer.Reader, AnyPointer.Builder> ctx) {
switch (methodId) {
case 0:
return result(testMethod0(internalGetTypedContext(Demo.TestParams0.factory, Demo.TestResults0.factory, ctx)));
case 1:
return result(testMethod1(internalGetTypedContext(Demo.TestParams1.factory, Demo.TestResults1.factory, ctx)));
default:
return result(internalUnimplemented(Demo.class.getName(), 0xa27d3c231c7b9202L, methodId));
}
}
public CompletableFuture<?> testMethod0(CallContext<Demo.TestParams0.Reader, Demo.TestResults0.Builder> ctx) {
return CompletableFuture.failedFuture(RpcException.unimplemented("testMethod0"));
}
public CompletableFuture<?> testMethod1(CallContext<Demo.TestParams1.Reader, Demo.TestResults1.Builder> ctx) {
return CompletableFuture.failedFuture(RpcException.unimplemented("testMethod1"));
}
}
}
class TestCap1 {
static final class Client extends org.capnproto.Capability.Client {
public Client() { super(); }
public Client(ClientHook hook) { super(hook); }
public Client(Capability.Client cap) { super(cap.hook); }
public Client(Capability.Server server) { super(server); }
}
static abstract class Server extends org.capnproto.Capability.Server {
@Override
public DispatchCallResult dispatchCall(long interfaceId, short methodId, CallContext<AnyPointer.Reader, AnyPointer.Builder> context) {
if (interfaceId == 0x81da3f8f6079c216L) {
return dispatchCallInternal(methodId, context);
}
return result(internalUnimplemented(Demo.class.getName(), interfaceId));
}
private DispatchCallResult dispatchCallInternal(short methodId, CallContext<AnyPointer.Reader, AnyPointer.Builder> ctx) {
switch (methodId) {
default:
return result(internalUnimplemented(Demo.class.getName(), 0x81da3f8f6079c216L, methodId));
}
}
}
}
class TestCap0Impl extends TestCap0.Server {
final TestCap1.Client testCap1a = new TestCap1.Client(new TestCap1Impl());
final TestCap1.Client testCap1b = new TestCap1.Client(new TestCap1Impl());
final Demo.TestCap1.Client testCap1a = new Demo.TestCap1.Client(new TestCap1Impl());
final Demo.TestCap1.Client testCap1b = new Demo.TestCap1.Client(new TestCap1Impl());
public CompletableFuture<?> testMethod0(CallContext<Demo.TestParams0.Reader, Demo.TestResults0.Builder> ctx) {
var params = ctx.getParams();
@ -108,42 +27,16 @@ class TestCap0Impl extends TestCap0.Server {
var params = ctx.getParams();
var results = ctx.getResults();
var res0 = results.getResult0();
res0.setAsCap(testCap1a);
res0.setAs(Demo.TestCap1.factory, testCap1a);
var res1 = results.getResult1();
res1.setAsCap(testCap1b);
res1.setAs(Demo.TestCap1.factory, testCap1b);
var res2 = results.getResult2();
res2.setAsCap(testCap1b);
res2.setAs(Demo.TestCap1.factory, testCap1b);
return CompletableFuture.completedFuture(null);
}
}
class TestCap1Impl extends TestCap1.Server {
}
class Iface0Impl extends Demo.Iface0.Server {
@Override
protected CompletableFuture<?> method0(CallContext<Demo.Iface0.Method0Params.Reader, Demo.Iface0.Method0Results.Builder> context) {
System.out.println("Called Iface0.method0");
return CompletableFuture.completedFuture(null);
}
@Override
protected CompletableFuture<?> method1(StreamingCallContext<Demo.Iface0.Method1Params.Reader> context) {
return super.method1(context);
}
}
class Iface1Impl extends Demo.Iface1.Server {
@Override
protected CompletableFuture<?> method0(CallContext<Demo.Iface1.Method0Params.Reader, Demo.Iface1.Method0Results.Builder> context) {
return super.method0(context);
}
@Override
protected CompletableFuture<?> method1(CallContext<Demo.Iface1.Method1Params.Reader, Demo.Iface1.Method1Results.Builder> context) {
context.getResults().setResult0(new Demo.Iface0.Client(new Iface0Impl()));
System.out.println("Called Iface0.method0");
return CompletableFuture.completedFuture(null);
}
class TestCap1Impl extends Demo.TestCap1.Server {
}
public class TwoPartyTest {
@ -172,49 +65,47 @@ public class TwoPartyTest {
@Test
public void testNullCap() {
var server = new TwoPartyServer(new Capability.Client());
server.listen(serverSocket);
var cap = this.client.bootstrap();
var resolved = cap.whenResolved();
var resolved = cap.whenResolved().toCompletableFuture();
resolved.join();
}
@Test
public void testBasic() throws ExecutionException, InterruptedException {
var capServer = new TestCap0Impl();
var server = new TwoPartyServer(new TestCap0.Client(capServer));
var server = new TwoPartyServer(new Demo.TestCap0.Client(capServer));
server.listen(serverSocket);
var demoClient = new TestCap0.Client(this.client.bootstrap());
var demoClient = new Demo.TestCap0.Client(this.client.bootstrap());
var request = demoClient.testMethod0Request();
var params = request.params();
var params = request.getParams();
params.setParam0(4321);
var promise = request.send();
while (!promise.response.isDone()) {
CompletableFuture.anyOf(promise.response, server.runOnce()).join();
var response = request.send();
while (!response.isDone()) {
CompletableFuture.anyOf(response, server.runOnce()).join();
}
Assert.assertTrue(promise.response.isDone());
var response = promise.response.get();
Assert.assertEquals(params.getParam0(), response.getResults().getResult0());
Assert.assertTrue(response.isDone());
var results = response.get();
Assert.assertEquals(params.getParam0(), results.getResult0());
}
@Test
public void testReturnCap() throws ExecutionException, InterruptedException {
// send a capabilty back from the server to the client
// send a capability back from the server to the client
var capServer = new TestCap0Impl();
var server = new TwoPartyServer(new TestCap0.Client(capServer));
var server = new TwoPartyServer(new Demo.TestCap0.Client(capServer));
server.listen(serverSocket);
var demoClient = new TestCap0.Client(this.client.bootstrap());
var demoClient = new Demo.TestCap0.Client(this.client.bootstrap());
var request = demoClient.testMethod1Request();
var params = request.params();
var promise = request.send();
while (!promise.response.isDone()) {
CompletableFuture.anyOf(promise.response, server.runOnce(), client.runOnce()).join();
var params = request.getParams();
var response = request.send();
while (!response.isDone()) {
CompletableFuture.anyOf(response, server.runOnce()).join();
}
Assert.assertTrue(promise.response.isDone());
Assert.assertTrue(response.isDone());
var response = promise.response.get();
var results = response.getResults();
var results = response.get();
var cap0 = results.getResult0();
Assert.assertFalse(cap0.isNull());
var cap1 = results.getResult1();
@ -226,35 +117,55 @@ public class TwoPartyTest {
@Test
public void testLocalServer() throws ExecutionException, InterruptedException {
var demo = new TestCap0Impl();
var client = new TestCap0.Client(demo);
var client = new Demo.TestCap0.Client(demo);
var request = client.testMethod0Request();
var params = request.params();
var params = request.getParams();
params.setParam0(4321);
var promise = request.send();
var future = promise.getResponse();
var response = future.get();
var results = response.getResults();
var response = request.send();
var results = response.get();
Assert.assertEquals(params.getParam0(), results.getResult0());
}
@Test
public void testGenericServer() throws ExecutionException, InterruptedException {
var demo = new TestCap0Impl();
var client = new TestCap0.Client(demo);
var client = new Demo.TestCap0.Client(demo);
var request = client.testMethod0Request();
var params = request.params();
var promise = request.send();
var future = promise.getResponse();
var response = future.get();
var results = response.getResults();
var params = request.getParams();
var response = request.send();
var results = response.get();
Assert.assertEquals(params.getParam0(), results.getResult0());
}
@Test
public void testTwoStagePipeline() {
var iface1Client = new Demo.Iface1.Client(new Iface1Impl());
var request = iface1Client.method1Request();
var response = request.send();
public void testLocalTwoStagePipeline() {
var server0 = new Demo.Iface0.Server() {
boolean method0called = false;
@Override
protected CompletableFuture<?> method0(CallContext<Demo.Iface0.Method0Params.Reader, Demo.Iface0.Method0Results.Builder> ctx) {
method0called = true;
return CompletableFuture.completedFuture(null);
}
};
var server1 = new Demo.Iface1.Server() {
@Override
protected CompletableFuture<?> method1(CallContext<Demo.Iface1.Method1Params.Reader, Demo.Iface1.Method1Results.Builder> ctx) {
ctx.getResults().setResult0(new Demo.Iface0.Client(server0));
return CompletableFuture.completedFuture(null);
}
};
var iface1Client = new Demo.Iface1.Client(server1);
var request1 = iface1Client.method1Request();
var response = request1.send();
var iface0 = response.getResult0();
var request0 = iface0.method0Request();
var response0 = request0.send();
response0.join();
Assert.assertTrue(!response0.isCompletedExceptionally());
Assert.assertTrue(server0.method0called);
}
}

View file

@ -6,7 +6,9 @@ package org.capnproto.demo;
public final class Demo {
public static class TestParams0 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)1,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -21,6 +23,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -52,20 +57,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class TestResults0 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)1,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -80,6 +83,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -111,20 +117,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class TestParams1 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)1);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -139,6 +143,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -178,20 +185,18 @@ public final class Demo {
}
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class TestResults1 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)3);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -206,6 +211,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -283,20 +291,18 @@ public final class Demo {
}
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Struct0 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)1,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -311,6 +317,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -342,40 +351,39 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Iface0 {
public static final class Factory extends org.capnproto.Capability.Factory<Client> {
public final Client newClient(org.capnproto.ClientHook hook) {
return new Client(hook);
}
}
public static final Factory factory = new Factory();
public static class Client extends org.capnproto.Capability.Client {
public Client() {}
public Client(org.capnproto.ClientHook hook) { super(hook); }
public Client(org.capnproto.Capability.Client cap) { super(cap.getHook()); }
public Client(org.capnproto.Capability.Client cap) { super(cap); }
public Client(Server server) { super(server); }
public Client(java.util.concurrent.CompletableFuture<org.capnproto.ClientHook> promise) {
public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {
super(promise);
}
public org.capnproto.Request<Method0Params.Builder, Method0Results.Reader> method0Request() {
public org.capnproto.Request<Method0Params.Builder, Method0Results.Pipeline> method0Request() {
return newCall(Method0Params.factory, Method0Results.factory, 0xac6d126c2fac16ebL, (short)0);
}
public org.capnproto.StreamingRequest<Method1Params.Builder> method1Request() {
return newStreamingCall(Method1Params.factory, 0xac6d126c2fac16ebL, (short)1);
}
}
public static abstract class Server extends org.capnproto.Capability.Server {
protected org.capnproto.DispatchCallResult dispatchCall(
long interfaceId, short methodId,
@ -419,7 +427,9 @@ public final class Demo {
public static class Method0Params {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -434,6 +444,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -454,20 +467,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method0Results {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -482,6 +493,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -502,20 +516,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method1Params {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -530,6 +542,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -550,23 +565,21 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
}
public static class Struct2 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)2);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -581,6 +594,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -612,7 +628,7 @@ public final class Demo {
return _getPointerField(org.capnproto.demo.Demo.Iface0.factory, 1);
}
public void setF1i(org.capnproto.demo.Demo.Iface0.Client value) {
_initPointerField(org.capnproto.demo.Demo.Iface0.factory, 1, 0);
_setPointerField(org.capnproto.demo.Demo.Iface0.factory, 1, value);
}
}
@ -636,19 +652,129 @@ public final class Demo {
}
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
public org.capnproto.demo.Demo.Iface0.Client getF1i() {
return new org.capnproto.demo.Demo.Iface0.Client(typeless.getPointerField((short)1).asCap());
return new org.capnproto.demo.Demo.Iface0.Client(this.getPointerField((short)1).asCap());
}
}
}
public static class TestCap0 {
public static final class Factory extends org.capnproto.Capability.Factory<Client> {
public final Client newClient(org.capnproto.ClientHook hook) {
return new Client(hook);
}
}
public static final Factory factory = new Factory();
public static class Client extends org.capnproto.Capability.Client {
public Client() {}
public Client(org.capnproto.ClientHook hook) { super(hook); }
public Client(org.capnproto.Capability.Client cap) { super(cap); }
public Client(Server server) { super(server); }
public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {
super(promise);
}
public org.capnproto.Request<org.capnproto.demo.Demo.TestParams0.Builder, org.capnproto.demo.Demo.TestResults0.Pipeline> testMethod0Request() {
return newCall(org.capnproto.demo.Demo.TestParams0.factory, org.capnproto.demo.Demo.TestResults0.factory, 0x9c0c5ee4bb0cc725L, (short)0);
}
public org.capnproto.Request<org.capnproto.demo.Demo.TestParams1.Builder, org.capnproto.demo.Demo.TestResults1.Pipeline> testMethod1Request() {
return newCall(org.capnproto.demo.Demo.TestParams1.factory, org.capnproto.demo.Demo.TestResults1.factory, 0x9c0c5ee4bb0cc725L, (short)1);
}
}
public static abstract class Server extends org.capnproto.Capability.Server {
protected org.capnproto.DispatchCallResult dispatchCall(
long interfaceId, short methodId,
org.capnproto.CallContext<org.capnproto.AnyPointer.Reader, org.capnproto.AnyPointer.Builder> context) {
if (interfaceId == 0x9c0c5ee4bb0cc725L) {
return dispatchCallInternal(methodId, context);
}
return org.capnproto.Capability.Server.result(
org.capnproto.Capability.Server.internalUnimplemented("TestCap0", interfaceId));
}
protected org.capnproto.DispatchCallResult dispatchCallInternal(short methodId, org.capnproto.CallContext<org.capnproto.AnyPointer.Reader, org.capnproto.AnyPointer.Builder> context) {
switch (methodId) {
case 0:
return org.capnproto.Capability.Server.result (
this.testMethod0(org.capnproto.Capability.Server.internalGetTypedContext(
org.capnproto.demo.Demo.TestParams0.factory, org.capnproto.demo.Demo.TestResults0.factory, context)));
case 1:
return org.capnproto.Capability.Server.result (
this.testMethod1(org.capnproto.Capability.Server.internalGetTypedContext(
org.capnproto.demo.Demo.TestParams1.factory, org.capnproto.demo.Demo.TestResults1.factory, context)));
default:
return org.capnproto.Capability.Server.result(
org.capnproto.Capability.Server.internalUnimplemented("TestCap0", 0x9c0c5ee4bb0cc725L, methodId));
}
}
protected java.util.concurrent.CompletableFuture<?> testMethod0(org.capnproto.CallContext<org.capnproto.demo.Demo.TestParams0.Reader, org.capnproto.demo.Demo.TestResults0.Builder> context) {
return org.capnproto.Capability.Server.internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0", "testMethod0",
0x9c0c5ee4bb0cc725L, (short)0);
}
protected java.util.concurrent.CompletableFuture<?> testMethod1(org.capnproto.CallContext<org.capnproto.demo.Demo.TestParams1.Reader, org.capnproto.demo.Demo.TestResults1.Builder> context) {
return org.capnproto.Capability.Server.internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0", "testMethod1",
0x9c0c5ee4bb0cc725L, (short)1);
}
}
}
public static class TestCap1 {
public static final class Factory extends org.capnproto.Capability.Factory<Client> {
public final Client newClient(org.capnproto.ClientHook hook) {
return new Client(hook);
}
}
public static final Factory factory = new Factory();
public static class Client extends org.capnproto.Capability.Client {
public Client() {}
public Client(org.capnproto.ClientHook hook) { super(hook); }
public Client(org.capnproto.Capability.Client cap) { super(cap); }
public Client(Server server) { super(server); }
public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {
super(promise);
}
}
public static abstract class Server extends org.capnproto.Capability.Server {
protected org.capnproto.DispatchCallResult dispatchCall(
long interfaceId, short methodId,
org.capnproto.CallContext<org.capnproto.AnyPointer.Reader, org.capnproto.AnyPointer.Builder> context) {
if (interfaceId == 0xd88e8bb64ed6f7b1L) {
return dispatchCallInternal(methodId, context);
}
return org.capnproto.Capability.Server.result(
org.capnproto.Capability.Server.internalUnimplemented("TestCap1", interfaceId));
}
protected org.capnproto.DispatchCallResult dispatchCallInternal(short methodId, org.capnproto.CallContext<org.capnproto.AnyPointer.Reader, org.capnproto.AnyPointer.Builder> context) {
switch (methodId) {
default:
return org.capnproto.Capability.Server.result(
org.capnproto.Capability.Server.internalUnimplemented("TestCap1", 0xd88e8bb64ed6f7b1L, methodId));
}
}
}
}
public static class Iface1 {
public static final class Factory extends org.capnproto.Capability.Factory<Client> {
@ -656,23 +782,26 @@ public final class Demo {
return new Client(hook);
}
}
public static final Factory factory = new Factory();
public static class Client extends org.capnproto.Capability.Client {
public Client() {}
public Client(org.capnproto.ClientHook hook) { super(hook); }
public Client(org.capnproto.Capability.Client cap) { super(cap.getHook()); }
public Client(org.capnproto.Capability.Client cap) { super(cap); }
public Client(Server server) { super(server); }
public Client(java.util.concurrent.CompletableFuture<org.capnproto.ClientHook> promise) {
public <T extends Client> Client(java.util.concurrent.CompletionStage<T> promise) {
super(promise);
}
public org.capnproto.Request<Method0Params.Builder, Method0Results.Reader> method0Request() {
public org.capnproto.Request<Method0Params.Builder, Method0Results.Pipeline> method0Request() {
return newCall(Method0Params.factory, Method0Results.factory, 0xd52dcf38c9f6f7c0L, (short)0);
}
public org.capnproto.Request<Method1Params.Builder, Method1Results.Reader> method1Request() {
public org.capnproto.Request<Method1Params.Builder, Method1Results.Pipeline> method1Request() {
return newCall(Method1Params.factory, Method1Results.factory, 0xd52dcf38c9f6f7c0L, (short)1);
}
}
public static abstract class Server extends org.capnproto.Capability.Server {
protected org.capnproto.DispatchCallResult dispatchCall(
long interfaceId, short methodId,
@ -716,7 +845,9 @@ public final class Demo {
public static class Struct1 {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)1,(short)1);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -731,6 +862,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -781,20 +915,18 @@ public final class Demo {
}
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method0Params {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -809,6 +941,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -829,20 +964,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method0Results {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)2);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -857,6 +990,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -909,20 +1045,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method1Params {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)0);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -937,6 +1071,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -957,20 +1094,18 @@ public final class Demo {
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
}
}
public static class Method1Results {
public static final org.capnproto.StructSize STRUCT_SIZE = new org.capnproto.StructSize((short)0,(short)1);
public static final class Factory extends org.capnproto.StructFactory<Builder, Reader> {
public static final class Factory
extends org.capnproto.StructFactory<Builder, Reader>
implements org.capnproto.PipelineFactory<Pipeline> {
public Factory() {
}
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
@ -985,6 +1120,9 @@ public final class Demo {
public final Reader asReader(Builder builder) {
return builder.asReader();
}
public Pipeline newPipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> promise) {
return new Pipeline(promise);
}
}
public static final Factory factory = new Factory();
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
@ -1003,7 +1141,7 @@ public final class Demo {
return _getPointerField(org.capnproto.demo.Demo.Iface0.factory, 0);
}
public void setResult0(org.capnproto.demo.Demo.Iface0.Client value) {
_initPointerField(org.capnproto.demo.Demo.Iface0.factory, 0, 0);
_setPointerField(org.capnproto.demo.Demo.Iface0.factory, 0, value);
}
}
@ -1021,21 +1159,17 @@ public final class Demo {
}
}
public static class Pipeline {
private org.capnproto.AnyPointer.Pipeline typeless;
public Pipeline() {}
public Pipeline(org.capnproto.AnyPointer.Pipeline typeless) {
this.typeless = typeless;
public static class Pipeline extends org.capnproto.Pipeline<Reader> {
public Pipeline(org.capnproto.RemotePromise<org.capnproto.AnyPointer.Reader> remotePromise) {
super(org.capnproto.RemotePromise.fromTypeless(factory, remotePromise));
}
public org.capnproto.demo.Demo.Iface0.Client getResult0() {
return new org.capnproto.demo.Demo.Iface0.Client(typeless.getPointerField((short)0).asCap());
return new org.capnproto.demo.Demo.Iface0.Client(this.getPointerField((short)0).asCap());
}
}
}
}
@ -1438,6 +1572,78 @@ public static final org.capnproto.SegmentReader b_a9395663e97ca3af =
"\u0011\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + "");
public static final org.capnproto.SegmentReader b_9c0c5ee4bb0cc725 =
org.capnproto.GeneratedClassSupport.decodeRawBytes(
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
"\u0025\u00c7\u000c\u00bb\u00e4\u005e\u000c\u009c" +
"\u0034\u0000\u0000\u0000\u0003\u0000\u0000\u0000" +
"\u0042\u0047\u00e8\u0082\u0015\u007a\u0057\u00b6" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0015\u0000\u0000\u0000\u00ea\u0001\u0000\u0000" +
"\u0031\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u002d\u0000\u0000\u0000\u0087\u0000\u0000\u0000" +
"\u0085\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
"\u0073\u0072\u0063\u002f\u0074\u0065\u0073\u0074" +
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
"\u006f\u0074\u006f\u002f\u0064\u0065\u006d\u006f" +
"\u002f\u0064\u0065\u006d\u006f\u002e\u0063\u0061" +
"\u0070\u006e\u0070\u003a\u0054\u0065\u0073\u0074" +
"\u0043\u0061\u0070\u0030\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
"\u0008\u0000\u0000\u0000\u0003\u0000\u0005\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u00b0\u005a\u0096\u00de\u0038\u00b1\u00e1\u0091" +
"\u00bf\u00dc\u00d1\u003b\u003c\u00dd\u007b\u00a7" +
"\u0031\u0000\u0000\u0000\u0062\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0029\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0049\u0090\u0033\u0012\u00e4\u0033\u000f\u00b2" +
"\u0063\u0069\u0053\u00ab\u0092\u0023\u0034\u00d1" +
"\u001d\u0000\u0000\u0000\u0062\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0015\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0074\u0065\u0073\u0074\u004d\u0065\u0074\u0068" +
"\u006f\u0064\u0030\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000" +
"\u0074\u0065\u0073\u0074\u004d\u0065\u0074\u0068" +
"\u006f\u0064\u0031\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000" +
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" + "");
public static final org.capnproto.SegmentReader b_d88e8bb64ed6f7b1 =
org.capnproto.GeneratedClassSupport.decodeRawBytes(
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
"\u00b1\u00f7\u00d6\u004e\u00b6\u008b\u008e\u00d8" +
"\u0034\u0000\u0000\u0000\u0003\u0000\u0000\u0000" +
"\u0042\u0047\u00e8\u0082\u0015\u007a\u0057\u00b6" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0015\u0000\u0000\u0000\u00ea\u0001\u0000\u0000" +
"\u0031\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u002d\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u002d\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
"\u0073\u0072\u0063\u002f\u0074\u0065\u0073\u0074" +
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
"\u006f\u0074\u006f\u002f\u0064\u0065\u006d\u006f" +
"\u002f\u0064\u0065\u006d\u006f\u002e\u0063\u0061" +
"\u0070\u006e\u0070\u003a\u0054\u0065\u0073\u0074" +
"\u0043\u0061\u0070\u0031\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
"\u0000\u0000\u0000\u0000\u0003\u0000\u0005\u0000" +
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" + "");
public static final org.capnproto.SegmentReader b_d52dcf38c9f6f7c0 =
org.capnproto.GeneratedClassSupport.decodeRawBytes(
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +

View file

@ -36,6 +36,15 @@ struct Struct2 {
f1i @1 :Iface0;
}
interface TestCap0 {
testMethod0 @0 TestParams0 -> TestResults0;
testMethod1 @1 TestParams1 -> TestResults1;
}
interface TestCap1 {
}
interface Iface1 {
struct Struct1 {

View file

@ -495,6 +495,99 @@ const ::capnp::_::RawSchema s_a9395663e97ca3af = {
1, 2, i_a9395663e97ca3af, nullptr, nullptr, { &s_a9395663e97ca3af, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<45> b_9c0c5ee4bb0cc725 = {
{ 0, 0, 0, 0, 5, 0, 6, 0,
37, 199, 12, 187, 228, 94, 12, 156,
52, 0, 0, 0, 3, 0, 0, 0,
66, 71, 232, 130, 21, 122, 87, 182,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 234, 1, 0, 0,
49, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
45, 0, 0, 0, 135, 0, 0, 0,
133, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
114, 117, 110, 116, 105, 109, 101, 47,
115, 114, 99, 47, 116, 101, 115, 116,
47, 106, 97, 118, 97, 47, 111, 114,
103, 47, 99, 97, 112, 110, 112, 114,
111, 116, 111, 47, 100, 101, 109, 111,
47, 100, 101, 109, 111, 46, 99, 97,
112, 110, 112, 58, 84, 101, 115, 116,
67, 97, 112, 48, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0,
8, 0, 0, 0, 3, 0, 5, 0,
0, 0, 0, 0, 0, 0, 0, 0,
176, 90, 150, 222, 56, 177, 225, 145,
191, 220, 209, 59, 60, 221, 123, 167,
49, 0, 0, 0, 98, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
41, 0, 0, 0, 7, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
73, 144, 51, 18, 228, 51, 15, 178,
99, 105, 83, 171, 146, 35, 52, 209,
29, 0, 0, 0, 98, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 7, 0, 0, 0,
116, 101, 115, 116, 77, 101, 116, 104,
111, 100, 48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0,
116, 101, 115, 116, 77, 101, 116, 104,
111, 100, 49, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 1, 0, 1, 0, }
};
::capnp::word const* const bp_9c0c5ee4bb0cc725 = b_9c0c5ee4bb0cc725.words;
#if !CAPNP_LITE
static const ::capnp::_::RawSchema* const d_9c0c5ee4bb0cc725[] = {
&s_91e1b138de965ab0,
&s_a77bdd3c3bd1dcbf,
&s_b20f33e412339049,
&s_d1342392ab536963,
};
static const uint16_t m_9c0c5ee4bb0cc725[] = {0, 1};
const ::capnp::_::RawSchema s_9c0c5ee4bb0cc725 = {
0x9c0c5ee4bb0cc725, b_9c0c5ee4bb0cc725.words, 45, d_9c0c5ee4bb0cc725, m_9c0c5ee4bb0cc725,
4, 2, nullptr, nullptr, nullptr, { &s_9c0c5ee4bb0cc725, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<23> b_d88e8bb64ed6f7b1 = {
{ 0, 0, 0, 0, 5, 0, 6, 0,
177, 247, 214, 78, 182, 139, 142, 216,
52, 0, 0, 0, 3, 0, 0, 0,
66, 71, 232, 130, 21, 122, 87, 182,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 234, 1, 0, 0,
49, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
45, 0, 0, 0, 7, 0, 0, 0,
45, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
114, 117, 110, 116, 105, 109, 101, 47,
115, 114, 99, 47, 116, 101, 115, 116,
47, 106, 97, 118, 97, 47, 111, 114,
103, 47, 99, 97, 112, 110, 112, 114,
111, 116, 111, 47, 100, 101, 109, 111,
47, 100, 101, 109, 111, 46, 99, 97,
112, 110, 112, 58, 84, 101, 115, 116,
67, 97, 112, 49, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 3, 0, 5, 0,
0, 0, 0, 0, 1, 0, 1, 0, }
};
::capnp::word const* const bp_d88e8bb64ed6f7b1 = b_d88e8bb64ed6f7b1.words;
#if !CAPNP_LITE
const ::capnp::_::RawSchema s_d88e8bb64ed6f7b1 = {
0xd88e8bb64ed6f7b1, b_d88e8bb64ed6f7b1.words, 23, nullptr, nullptr,
0, 0, nullptr, nullptr, nullptr, { &s_d88e8bb64ed6f7b1, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<46> b_d52dcf38c9f6f7c0 = {
{ 0, 0, 0, 0, 5, 0, 6, 0,
192, 247, 246, 201, 56, 207, 45, 213,
@ -945,6 +1038,98 @@ constexpr ::capnp::Kind Struct2::_capnpPrivate::kind;
constexpr ::capnp::_::RawSchema const* Struct2::_capnpPrivate::schema;
#endif // !CAPNP_LITE
#if !CAPNP_LITE
::capnp::Request< ::TestParams0, ::TestResults0>
TestCap0::Client::testMethod0Request(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
return newCall< ::TestParams0, ::TestResults0>(
0x9c0c5ee4bb0cc725ull, 0, sizeHint);
}
::kj::Promise<void> TestCap0::Server::testMethod0(TestMethod0Context) {
return ::capnp::Capability::Server::internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0", "testMethod0",
0x9c0c5ee4bb0cc725ull, 0);
}
::capnp::Request< ::TestParams1, ::TestResults1>
TestCap0::Client::testMethod1Request(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
return newCall< ::TestParams1, ::TestResults1>(
0x9c0c5ee4bb0cc725ull, 1, sizeHint);
}
::kj::Promise<void> TestCap0::Server::testMethod1(TestMethod1Context) {
return ::capnp::Capability::Server::internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0", "testMethod1",
0x9c0c5ee4bb0cc725ull, 1);
}
::capnp::Capability::Server::DispatchCallResult TestCap0::Server::dispatchCall(
uint64_t interfaceId, uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
switch (interfaceId) {
case 0x9c0c5ee4bb0cc725ull:
return dispatchCallInternal(methodId, context);
default:
return internalUnimplemented("runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0", interfaceId);
}
}
::capnp::Capability::Server::DispatchCallResult TestCap0::Server::dispatchCallInternal(
uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
switch (methodId) {
case 0:
return {
testMethod0(::capnp::Capability::Server::internalGetTypedContext<
::TestParams0, ::TestResults0>(context)),
false
};
case 1:
return {
testMethod1(::capnp::Capability::Server::internalGetTypedContext<
::TestParams1, ::TestResults1>(context)),
false
};
default:
(void)context;
return ::capnp::Capability::Server::internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap0",
0x9c0c5ee4bb0cc725ull, methodId);
}
}
#endif // !CAPNP_LITE
// TestCap0
#if !CAPNP_LITE
constexpr ::capnp::Kind TestCap0::_capnpPrivate::kind;
constexpr ::capnp::_::RawSchema const* TestCap0::_capnpPrivate::schema;
#endif // !CAPNP_LITE
#if !CAPNP_LITE
::capnp::Capability::Server::DispatchCallResult TestCap1::Server::dispatchCall(
uint64_t interfaceId, uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
switch (interfaceId) {
case 0xd88e8bb64ed6f7b1ull:
return dispatchCallInternal(methodId, context);
default:
return internalUnimplemented("runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap1", interfaceId);
}
}
::capnp::Capability::Server::DispatchCallResult TestCap1::Server::dispatchCallInternal(
uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
switch (methodId) {
default:
(void)context;
return ::capnp::Capability::Server::internalUnimplemented(
"runtime/src/test/java/org/capnproto/demo/demo.capnp:TestCap1",
0xd88e8bb64ed6f7b1ull, methodId);
}
}
#endif // !CAPNP_LITE
// TestCap1
#if !CAPNP_LITE
constexpr ::capnp::Kind TestCap1::_capnpPrivate::kind;
constexpr ::capnp::_::RawSchema const* TestCap1::_capnpPrivate::schema;
#endif // !CAPNP_LITE
#if !CAPNP_LITE
::capnp::Request< ::Iface1::Method0Params, ::Iface1::Method0Results>
Iface1::Client::method0Request(::kj::Maybe< ::capnp::MessageSize> sizeHint) {

View file

@ -27,6 +27,8 @@ CAPNP_DECLARE_SCHEMA(bc8d77edaa76294b);
CAPNP_DECLARE_SCHEMA(f744e24aa684673e);
CAPNP_DECLARE_SCHEMA(c8c25b78d234f324);
CAPNP_DECLARE_SCHEMA(a9395663e97ca3af);
CAPNP_DECLARE_SCHEMA(9c0c5ee4bb0cc725);
CAPNP_DECLARE_SCHEMA(d88e8bb64ed6f7b1);
CAPNP_DECLARE_SCHEMA(d52dcf38c9f6f7c0);
CAPNP_DECLARE_SCHEMA(800ca862fbfddd38);
CAPNP_DECLARE_SCHEMA(8f92ca18632e04d5);
@ -193,6 +195,40 @@ struct Struct2 {
};
};
struct TestCap0 {
TestCap0() = delete;
#if !CAPNP_LITE
class Client;
class Server;
#endif // !CAPNP_LITE
#if !CAPNP_LITE
struct _capnpPrivate {
CAPNP_DECLARE_INTERFACE_HEADER(9c0c5ee4bb0cc725)
static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; }
};
#endif // !CAPNP_LITE
};
struct TestCap1 {
TestCap1() = delete;
#if !CAPNP_LITE
class Client;
class Server;
#endif // !CAPNP_LITE
#if !CAPNP_LITE
struct _capnpPrivate {
CAPNP_DECLARE_INTERFACE_HEADER(d88e8bb64ed6f7b1)
static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; }
};
#endif // !CAPNP_LITE
};
struct Iface1 {
Iface1() = delete;
@ -1054,6 +1090,108 @@ private:
};
#endif // !CAPNP_LITE
#if !CAPNP_LITE
class TestCap0::Client
: public virtual ::capnp::Capability::Client {
public:
typedef TestCap0 Calls;
typedef TestCap0 Reads;
Client(decltype(nullptr));
explicit Client(::kj::Own< ::capnp::ClientHook>&& hook);
template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Server*>()>>
Client(::kj::Own<_t>&& server);
template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Client*>()>>
Client(::kj::Promise<_t>&& promise);
Client(::kj::Exception&& exception);
Client(Client&) = default;
Client(Client&&) = default;
Client& operator=(Client& other);
Client& operator=(Client&& other);
::capnp::Request< ::TestParams0, ::TestResults0> testMethod0Request(
::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr);
::capnp::Request< ::TestParams1, ::TestResults1> testMethod1Request(
::kj::Maybe< ::capnp::MessageSize> sizeHint = nullptr);
protected:
Client() = default;
};
class TestCap0::Server
: public virtual ::capnp::Capability::Server {
public:
typedef TestCap0 Serves;
::capnp::Capability::Server::DispatchCallResult dispatchCall(
uint64_t interfaceId, uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
override;
protected:
typedef ::capnp::CallContext< ::TestParams0, ::TestResults0> TestMethod0Context;
virtual ::kj::Promise<void> testMethod0(TestMethod0Context context);
typedef ::capnp::CallContext< ::TestParams1, ::TestResults1> TestMethod1Context;
virtual ::kj::Promise<void> testMethod1(TestMethod1Context context);
inline ::TestCap0::Client thisCap() {
return ::capnp::Capability::Server::thisCap()
.template castAs< ::TestCap0>();
}
::capnp::Capability::Server::DispatchCallResult dispatchCallInternal(
uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif // !CAPNP_LITE
#if !CAPNP_LITE
class TestCap1::Client
: public virtual ::capnp::Capability::Client {
public:
typedef TestCap1 Calls;
typedef TestCap1 Reads;
Client(decltype(nullptr));
explicit Client(::kj::Own< ::capnp::ClientHook>&& hook);
template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Server*>()>>
Client(::kj::Own<_t>&& server);
template <typename _t, typename = ::kj::EnableIf< ::kj::canConvert<_t*, Client*>()>>
Client(::kj::Promise<_t>&& promise);
Client(::kj::Exception&& exception);
Client(Client&) = default;
Client(Client&&) = default;
Client& operator=(Client& other);
Client& operator=(Client&& other);
protected:
Client() = default;
};
class TestCap1::Server
: public virtual ::capnp::Capability::Server {
public:
typedef TestCap1 Serves;
::capnp::Capability::Server::DispatchCallResult dispatchCall(
uint64_t interfaceId, uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context)
override;
protected:
inline ::TestCap1::Client thisCap() {
return ::capnp::Capability::Server::thisCap()
.template castAs< ::TestCap1>();
}
::capnp::Capability::Server::DispatchCallResult dispatchCallInternal(
uint16_t methodId,
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context);
};
#endif // !CAPNP_LITE
#if !CAPNP_LITE
class Iface1::Client
: public virtual ::capnp::Capability::Client {
@ -1739,6 +1877,54 @@ inline ::capnp::Orphan< ::Iface0> Struct2::Builder::disownF1i() {
}
#endif // !CAPNP_LITE
#if !CAPNP_LITE
inline TestCap0::Client::Client(decltype(nullptr))
: ::capnp::Capability::Client(nullptr) {}
inline TestCap0::Client::Client(
::kj::Own< ::capnp::ClientHook>&& hook)
: ::capnp::Capability::Client(::kj::mv(hook)) {}
template <typename _t, typename>
inline TestCap0::Client::Client(::kj::Own<_t>&& server)
: ::capnp::Capability::Client(::kj::mv(server)) {}
template <typename _t, typename>
inline TestCap0::Client::Client(::kj::Promise<_t>&& promise)
: ::capnp::Capability::Client(::kj::mv(promise)) {}
inline TestCap0::Client::Client(::kj::Exception&& exception)
: ::capnp::Capability::Client(::kj::mv(exception)) {}
inline ::TestCap0::Client& TestCap0::Client::operator=(Client& other) {
::capnp::Capability::Client::operator=(other);
return *this;
}
inline ::TestCap0::Client& TestCap0::Client::operator=(Client&& other) {
::capnp::Capability::Client::operator=(kj::mv(other));
return *this;
}
#endif // !CAPNP_LITE
#if !CAPNP_LITE
inline TestCap1::Client::Client(decltype(nullptr))
: ::capnp::Capability::Client(nullptr) {}
inline TestCap1::Client::Client(
::kj::Own< ::capnp::ClientHook>&& hook)
: ::capnp::Capability::Client(::kj::mv(hook)) {}
template <typename _t, typename>
inline TestCap1::Client::Client(::kj::Own<_t>&& server)
: ::capnp::Capability::Client(::kj::mv(server)) {}
template <typename _t, typename>
inline TestCap1::Client::Client(::kj::Promise<_t>&& promise)
: ::capnp::Capability::Client(::kj::mv(promise)) {}
inline TestCap1::Client::Client(::kj::Exception&& exception)
: ::capnp::Capability::Client(::kj::mv(exception)) {}
inline ::TestCap1::Client& TestCap1::Client::operator=(Client& other) {
::capnp::Capability::Client::operator=(other);
return *this;
}
inline ::TestCap1::Client& TestCap1::Client::operator=(Client&& other) {
::capnp::Capability::Client::operator=(kj::mv(other));
return *this;
}
#endif // !CAPNP_LITE
#if !CAPNP_LITE
inline Iface1::Client::Client(decltype(nullptr))
: ::capnp::Capability::Client(nullptr) {}