add runtime-rpc module and refactor project
This commit is contained in:
parent
0283fc5c2d
commit
9e6d495d56
31 changed files with 2384 additions and 9317 deletions
|
@ -39,13 +39,11 @@
|
|||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -80,7 +78,6 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<!--
|
||||
<execution>
|
||||
<id>generate-test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
|
@ -95,6 +92,7 @@
|
|||
<arg value="-o../capnpc-java:src/test/generated"/>
|
||||
<arg value="src/test/schema/test.capnp"/>
|
||||
<arg value="src/test/schema/test-import.capnp"/>
|
||||
<env key="CAPNP_LITE" value="1"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
|
@ -102,11 +100,9 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
-->
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
|
@ -126,7 +122,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<module>compiler</module>
|
||||
<module>examples</module>
|
||||
<module>benchmark</module>
|
||||
<module>compiler-tests</module>
|
||||
<module>runtime-rpc</module>
|
||||
</modules>
|
||||
<licenses>
|
||||
<license>
|
||||
|
|
228
runtime-rpc/pom.xml
Normal file
228
runtime-rpc/pom.xml
Normal file
|
@ -0,0 +1,228 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>runtime-rpc</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>runtime-rpc</description>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
<name>Cap'n Proto runtime library</name>
|
||||
<organization>
|
||||
<name>org.capnproto</name>
|
||||
</organization>
|
||||
<url>https://capnproto.org/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>MIT</name>
|
||||
<url>http://opensource.org/licenses/MIT</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<url>git@github.com:capnproto/capnproto-java.git</url>
|
||||
<connection>scm:git@github.com:capnproto/capnproto-java.git</connection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>dwrensha</id>
|
||||
<name>David Renshaw</name>
|
||||
<url>https://github.com/dwrensha</url>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>vaci</id>
|
||||
<name>Vaci Koblizek</name>
|
||||
<url>https://github.com/vaci</url>
|
||||
</developer>
|
||||
</developers>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
<source>14</source>
|
||||
<target>14</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-rpc-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="src/main/generated/org/capnproto"/>
|
||||
<exec executable="capnp" failonerror="true">
|
||||
<arg value="compile"/>
|
||||
<arg value="-I"/>
|
||||
<arg value="../compiler/src/main/schema/"/>
|
||||
<arg value="--src-prefix=src/main/schema/"/>
|
||||
<arg value="-o../capnpc-java:src/main/generated/org/capnproto"/>
|
||||
<arg value="src/main/schema/rpc.capnp"/>
|
||||
<arg value="src/main/schema/rpc-twoparty.capnp"/>
|
||||
<env key="CAPNP_LITE" value="1"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-rpc-test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="src/test/generated/org/capnproto"/>
|
||||
<exec executable="capnp" failonerror="true">
|
||||
<arg value="compile"/>
|
||||
<arg value="-I"/>
|
||||
<arg value="../compiler/src/main/schema/"/>
|
||||
<arg value="--src-prefix=src/test/schema/"/>
|
||||
<arg value="-o../capnpc-java:src/test/generated/org/capnproto"/>
|
||||
<arg value="src/test/schema/test.capnp"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-generated-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/generated</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-generated-test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/generated</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnError>false</failOnError>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -346,7 +346,7 @@ final class RpcState<VatId> {
|
|||
int sizeHint = messageSizeHint() + exceptionSizeHint(exc);
|
||||
var message = this.connection.newOutgoingMessage(sizeHint);
|
||||
var abort = message.getBody().getAs(RpcProtocol.Message.factory).initAbort();
|
||||
RpcException.fromException(exc, abort);
|
||||
FromException(exc, abort);
|
||||
message.send();
|
||||
}
|
||||
catch (Throwable abortFailed) {
|
||||
|
@ -511,7 +511,7 @@ final class RpcState<VatId> {
|
|||
}
|
||||
|
||||
void handleAbort(RpcProtocol.Exception.Reader abort) throws RpcException {
|
||||
throw RpcException.toException(abort);
|
||||
throw ToException(abort);
|
||||
}
|
||||
|
||||
void handleBootstrap(IncomingRpcMessage message, RpcProtocol.Bootstrap.Reader bootstrap) {
|
||||
|
@ -538,7 +538,7 @@ final class RpcState<VatId> {
|
|||
var payload = ret.initResults();
|
||||
var content = payload.getContent().imbue(capTable);
|
||||
var cap = this.bootstrapFactory.createFor(connection.getPeerVatId());
|
||||
content.setAsCap(cap);
|
||||
content.setAs(Capability.factory, cap);
|
||||
var caps = capTable.getTable();
|
||||
var capHook = caps.length != 0
|
||||
? caps[0]
|
||||
|
@ -676,7 +676,7 @@ final class RpcState<VatId> {
|
|||
assert false: "Tail call `Return` must set `resultsSentElsewhere`, not `exception`.";
|
||||
break;
|
||||
}
|
||||
question.reject(RpcException.toException(callReturn.getException()));
|
||||
question.reject(ToException(callReturn.getException()));
|
||||
break;
|
||||
|
||||
case CANCELED:
|
||||
|
@ -752,7 +752,7 @@ final class RpcState<VatId> {
|
|||
cap = receiveCap(resolve.getCap(), message.getAttachedFds());
|
||||
break;
|
||||
case EXCEPTION:
|
||||
exc = RpcException.toException(resolve.getException());
|
||||
exc = ToException(resolve.getException());
|
||||
break;
|
||||
default:
|
||||
assert false: "Unknown 'Resolve' type.";
|
||||
|
@ -976,7 +976,7 @@ final class RpcState<VatId> {
|
|||
var message = connection.newOutgoingMessage(sizeHint);
|
||||
var resolve = message.getBody().initAs(RpcProtocol.Message.factory).initResolve();
|
||||
resolve.setPromiseId(exportId);
|
||||
RpcException.fromException(exc, resolve.initException());
|
||||
FromException(exc, resolve.initException());
|
||||
message.send();
|
||||
|
||||
// TODO disconnect?
|
||||
|
@ -1053,7 +1053,7 @@ final class RpcState<VatId> {
|
|||
case RECEIVER_ANSWER:
|
||||
var promisedAnswer = descriptor.getReceiverAnswer();
|
||||
var answer = answers.find(promisedAnswer.getQuestionId());
|
||||
var ops = PipelineOp.ToPipelineOps(promisedAnswer);
|
||||
var ops = ToPipelineOps(promisedAnswer);
|
||||
|
||||
if (answer == null || !answer.active || answer.pipeline == null || ops == null) {
|
||||
return Capability.newBrokenCap("invalid 'receiverAnswer'");
|
||||
|
@ -1158,7 +1158,7 @@ final class RpcState<VatId> {
|
|||
RpcException.failed("Pipeline call on a request that returned no capabilities or was already closed."));
|
||||
}
|
||||
|
||||
var ops = PipelineOp.ToPipelineOps(promisedAnswer);
|
||||
var ops = ToPipelineOps(promisedAnswer);
|
||||
if (ops == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1404,7 +1404,7 @@ final class RpcState<VatId> {
|
|||
var builder = message.getBody().initAs(RpcProtocol.Message.factory).initReturn();
|
||||
builder.setAnswerId(this.answerId);
|
||||
builder.setReleaseParamCaps(false);
|
||||
RpcException.fromException(exc, builder.initException());
|
||||
FromException(exc, builder.initException());
|
||||
message.send();
|
||||
}
|
||||
|
||||
|
@ -1891,7 +1891,7 @@ final class RpcState<VatId> {
|
|||
public Integer writeDescriptor(RpcProtocol.CapDescriptor.Builder descriptor, List<Integer> fds) {
|
||||
var promisedAnswer = descriptor.initReceiverAnswer();
|
||||
promisedAnswer.setQuestionId(question.getId());
|
||||
PipelineOp.FromPipelineOps(ops, promisedAnswer);
|
||||
FromPipelineOps(ops, promisedAnswer);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1899,8 +1899,66 @@ final class RpcState<VatId> {
|
|||
public ClientHook writeTarget(RpcProtocol.MessageTarget.Builder target) {
|
||||
var builder = target.initPromisedAnswer();
|
||||
builder.setQuestionId(question.getId());
|
||||
PipelineOp.FromPipelineOps(ops, builder);
|
||||
FromPipelineOps(ops, builder);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void FromPipelineOps(PipelineOp[] ops, RpcProtocol.PromisedAnswer.Builder builder) {
|
||||
var transforms = builder.initTransform(ops.length);
|
||||
for (int ii = 0; ii < ops.length; ++ii) {
|
||||
switch (ops[ii].type) {
|
||||
case NOOP:
|
||||
transforms.get(ii).setNoop(null);
|
||||
break;
|
||||
case GET_POINTER_FIELD:
|
||||
transforms.get(ii).setGetPointerField(ops[ii].pointerIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PipelineOp[] ToPipelineOps(RpcProtocol.PromisedAnswer.Reader reader) {
|
||||
var transforms = reader.getTransform();
|
||||
var ops = new PipelineOp[transforms.size()];
|
||||
for (int ii = 0; ii < ops.length; ++ii) {
|
||||
var transform = transforms.get(ii);
|
||||
switch (transform.which()) {
|
||||
case NOOP:
|
||||
ops[ii] = PipelineOp.Noop(); // TODO null?
|
||||
break;
|
||||
case GET_POINTER_FIELD:
|
||||
ops[ii] = PipelineOp.PointerField(transform.getGetPointerField());
|
||||
break;
|
||||
default:
|
||||
// TODO improve error handling here
|
||||
// Unsupported pipeline ops
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return ops;
|
||||
}
|
||||
|
||||
static void FromException(Throwable exc, RpcProtocol.Exception.Builder builder) {
|
||||
builder.setReason(exc.getMessage());
|
||||
builder.setType(RpcProtocol.Exception.Type.FAILED);
|
||||
}
|
||||
|
||||
static RpcException ToException(RpcProtocol.Exception.Reader reader) {
|
||||
var type = RpcException.Type.UNKNOWN;
|
||||
|
||||
switch (reader.getType()) {
|
||||
case UNIMPLEMENTED:
|
||||
type = RpcException.Type.UNIMPLEMENTED;
|
||||
break;
|
||||
case FAILED:
|
||||
type = RpcException.Type.FAILED;
|
||||
break;
|
||||
case DISCONNECTED:
|
||||
case OVERLOADED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new RpcException(type, reader.getReason().toString());
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import java.nio.channels.CompletionHandler;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
|
||||
public class TwoPartyServer {
|
||||
|
|
@ -4,7 +4,6 @@ import java.nio.channels.AsynchronousSocketChannel;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
||||
public class TwoPartyVatNetwork
|
||||
implements VatNetwork<RpcTwoPartyProtocol.VatId.Reader>,
|
||||
VatNetwork.Connection<RpcTwoPartyProtocol.VatId.Reader> {
|
173
runtime-rpc/src/main/schema/rpc-twoparty.capnp
Normal file
173
runtime-rpc/src/main/schema/rpc-twoparty.capnp
Normal file
|
@ -0,0 +1,173 @@
|
|||
# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
|
||||
# Licensed under the MIT License:
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
@0xa184c7885cdaf2a1;
|
||||
# This file defines the "network-specific parameters" in rpc.capnp to support a network consisting
|
||||
# of two vats. Each of these vats may in fact be in communication with other vats, but any
|
||||
# capabilities they forward must be proxied. Thus, to each end of the connection, all capabilities
|
||||
# received from the other end appear to live in a single vat.
|
||||
#
|
||||
# Two notable use cases for this model include:
|
||||
# - Regular client-server communications, where a remote client machine (perhaps living on an end
|
||||
# user's personal device) connects to a server. The server may be part of a cluster, and may
|
||||
# call on other servers in the cluster to help service the user's request. It may even obtain
|
||||
# capabilities from these other servers which it passes on to the user. To simplify network
|
||||
# common traversal problems (e.g. if the user is behind a firewall), it is probably desirable to
|
||||
# multiplex all communications between the server cluster and the client over the original
|
||||
# connection rather than form new ones. This connection should use the two-party protocol, as
|
||||
# the client has no interest in knowing about additional servers.
|
||||
# - Applications running in a sandbox. A supervisor process may execute a confined application
|
||||
# such that all of the confined app's communications with the outside world must pass through
|
||||
# the supervisor. In this case, the connection between the confined app and the supervisor might
|
||||
# as well use the two-party protocol, because the confined app is intentionally prevented from
|
||||
# talking to any other vat anyway. Any external resources will be proxied through the supervisor,
|
||||
# and so to the contained app will appear as if they were hosted by the supervisor itself.
|
||||
#
|
||||
# Since there are only two vats in this network, there is never a need for three-way introductions,
|
||||
# so level 3 is free. Moreover, because it is never necessary to form new connections, the
|
||||
# two-party protocol can be used easily anywhere where a two-way byte stream exists, without regard
|
||||
# to where that byte stream goes or how it was initiated. This makes the two-party runtime library
|
||||
# highly reusable.
|
||||
#
|
||||
# Joins (level 4) _could_ be needed in cases where one or both vats are participating in other
|
||||
# networks that use joins. For instance, if Alice and Bob are speaking through the two-party
|
||||
# protocol, and Bob is also participating on another network, Bob may send Alice two or more
|
||||
# proxied capabilities which, unbeknownst to Bob at the time, are in fact pointing at the same
|
||||
# remote object. Alice may then request to join these capabilities, at which point Bob will have
|
||||
# to forward the join to the other network. Note, however, that if Alice is _not_ participating on
|
||||
# any other network, then Alice will never need to _receive_ a Join, because Alice would always
|
||||
# know when two locally-hosted capabilities are the same and would never export a redundant alias
|
||||
# to Bob. So, Alice can respond to all incoming joins with an error, and only needs to implement
|
||||
# outgoing joins if she herself desires to use this feature. Also, outgoing joins are relatively
|
||||
# easy to implement in this scenario.
|
||||
#
|
||||
# What all this means is that a level 4 implementation of the confined network is barely more
|
||||
# complicated than a level 2 implementation. However, such an implementation allows the "client"
|
||||
# or "confined" app to access the server's/supervisor's network with equal functionality to any
|
||||
# native participant. In other words, an application which implements only the two-party protocol
|
||||
# can be paired with a proxy app in order to participate in any network.
|
||||
#
|
||||
# So, when implementing Cap'n Proto in a new language, it makes sense to implement only the
|
||||
# two-party protocol initially, and then pair applications with an appropriate proxy written in
|
||||
# C++, rather than implement other parameterizations of the RPC protocol directly.
|
||||
|
||||
using Cxx = import "/capnp/c++.capnp";
|
||||
$Cxx.namespace("capnp::rpc::twoparty");
|
||||
|
||||
using Java = import "/capnp/java.capnp";
|
||||
$Java.package("org.capnproto");
|
||||
$Java.outerClassname("RpcTwoPartyProtocol");
|
||||
|
||||
# Note: SturdyRef is not specified here. It is up to the application to define semantics of
|
||||
# SturdyRefs if desired.
|
||||
|
||||
enum Side {
|
||||
server @0;
|
||||
# The object lives on the "server" or "supervisor" end of the connection. Only the
|
||||
# server/supervisor knows how to interpret the ref; to the client, it is opaque.
|
||||
#
|
||||
# Note that containers intending to implement strong confinement should rewrite SturdyRefs
|
||||
# received from the external network before passing them on to the confined app. The confined
|
||||
# app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps
|
||||
# maliciously leak), but instead receives only a thing that it can pass back to the container
|
||||
# later to restore the ref. See:
|
||||
# http://www.erights.org/elib/capability/dist-confine.html
|
||||
|
||||
client @1;
|
||||
# The object lives on the "client" or "confined app" end of the connection. Only the client
|
||||
# knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not
|
||||
# actually know how to persist capabilities at all, so use of this is unusual.
|
||||
}
|
||||
|
||||
struct VatId {
|
||||
side @0 :Side;
|
||||
}
|
||||
|
||||
struct ProvisionId {
|
||||
# Only used for joins, since three-way introductions never happen on a two-party network.
|
||||
|
||||
joinId @0 :UInt32;
|
||||
# The ID from `JoinKeyPart`.
|
||||
}
|
||||
|
||||
struct RecipientId {}
|
||||
# Never used, because there are only two parties.
|
||||
|
||||
struct ThirdPartyCapId {}
|
||||
# Never used, because there is no third party.
|
||||
|
||||
struct JoinKeyPart {
|
||||
# Joins in the two-party case are simplified by a few observations.
|
||||
#
|
||||
# First, on a two-party network, a Join only ever makes sense if the receiving end is also
|
||||
# connected to other networks. A vat which is not connected to any other network can safely
|
||||
# reject all joins.
|
||||
#
|
||||
# Second, since a two-party connection bisects the network -- there can be no other connections
|
||||
# between the networks at either end of the connection -- if one part of a join crosses the
|
||||
# connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request
|
||||
# off some other network which needs to be forwarded across the two-party connection can
|
||||
# collect all the parts on its end and only forward them across the two-party connection when all
|
||||
# have been received.
|
||||
#
|
||||
# For example, imagine that Alice and Bob are vats connected over a two-party connection, and
|
||||
# each is also connected to other networks. At some point, Alice receives one part of a Join
|
||||
# request off her network. The request is addressed to a capability that Alice received from
|
||||
# Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as
|
||||
# if she hosted the capability locally (this is important so that if not all the Join parts end
|
||||
# up at Alice, the original sender can detect the failed Join without hanging). As other parts
|
||||
# trickle in, Alice verifies that each part is addressed to a capability from Bob and continues
|
||||
# to respond to each one. Once the complete set of join parts is received, Alice checks if they
|
||||
# were all for the exact same capability. If so, she doesn't need to send anything to Bob at
|
||||
# all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were
|
||||
# addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice
|
||||
# does not forward the Join parts she received herself, but essentially forwards the Join as a
|
||||
# whole.
|
||||
#
|
||||
# On Bob's end, since he knows that Alice will always send all parts of a Join together, he
|
||||
# simply waits until he's received them all, then performs a join on the respective capabilities
|
||||
# as if it had been requested locally.
|
||||
|
||||
joinId @0 :UInt32;
|
||||
# A number identifying this join, chosen by the sender. May be reused once `Finish` messages are
|
||||
# sent corresponding to all of the `Join` messages.
|
||||
|
||||
partCount @1 :UInt16;
|
||||
# The number of capabilities to be joined.
|
||||
|
||||
partNum @2 :UInt16;
|
||||
# Which part this request targets -- a number in the range [0, partCount).
|
||||
}
|
||||
|
||||
struct JoinResult {
|
||||
joinId @0 :UInt32;
|
||||
# Matches `JoinKeyPart`.
|
||||
|
||||
succeeded @1 :Bool;
|
||||
# All JoinResults in the set will have the same value for `succeeded`. The receiver actually
|
||||
# implements the join by waiting for all the `JoinKeyParts` and then performing its own join on
|
||||
# them, then going back and answering all the join requests afterwards.
|
||||
|
||||
cap @2 :AnyPointer;
|
||||
# One of the JoinResults will have a non-null `cap` which is the joined capability.
|
||||
#
|
||||
# TODO(cleanup): Change `AnyPointer` to `Capability` when that is supported.
|
||||
}
|
1480
runtime-rpc/src/main/schema/rpc.capnp
Normal file
1480
runtime-rpc/src/main/schema/rpc.capnp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,5 @@
|
|||
package org.capnproto;
|
||||
|
||||
// Copyright (c) 2018 Sandstorm Development Group, Inc. and contributors
|
||||
// Licensed under the MIT License:
|
||||
//
|
||||
|
@ -19,8 +21,10 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
package org.capnproto;
|
||||
|
||||
import org.capnproto.AnyPointer;
|
||||
import org.capnproto.CallContext;
|
||||
import org.capnproto.Capability;
|
||||
import org.capnproto.RpcException;
|
||||
import org.capnproto.test.Test;
|
||||
|
||||
import org.junit.Assert;
|
|
@ -117,7 +117,7 @@ public class RpcStateTest {
|
|||
public void handleAbort() {
|
||||
var msg = new TestMessage();
|
||||
var builder = msg.builder.getRoot(RpcProtocol.Message.factory);
|
||||
RpcException.fromException(RpcException.failed("Test abort"), builder.initAbort());
|
||||
RpcState.FromException(RpcException.failed("Test abort"), builder.initAbort());
|
||||
this.connection.setNextIncomingMessage(msg);
|
||||
//Assert.assertThrows(RpcException.class, () -> rpc.handleMessage(msg));
|
||||
}
|
410
runtime-rpc/src/test/java/org/capnproto/RpcTest.java
Normal file
410
runtime-rpc/src/test/java/org/capnproto/RpcTest.java
Normal file
|
@ -0,0 +1,410 @@
|
|||
// Copyright (c) 2018 Sandstorm Development Group, Inc. and contributors
|
||||
// Licensed under the MIT License:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
package org.capnproto;
|
||||
|
||||
import org.capnproto.test.Test;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class RpcTest {
|
||||
|
||||
final class TestNetwork {
|
||||
|
||||
final Map<String, TestNetworkAdapter> map = new HashMap<>();
|
||||
int received = 0;
|
||||
|
||||
TestNetworkAdapter add(String name) {
|
||||
return this.map.computeIfAbsent(
|
||||
name, key -> new TestNetworkAdapter(this, name));
|
||||
}
|
||||
|
||||
TestNetworkAdapter find(String name) {
|
||||
return this.map.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
final class TestNetworkAdapter
|
||||
implements VatNetwork<Test.TestSturdyRef.Reader> {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<VatNetwork.Connection<Test.TestSturdyRef.Reader>> baseAccept() {
|
||||
return this.accept().thenApply(conn -> conn);
|
||||
}
|
||||
|
||||
class Connection implements VatNetwork.Connection<Test.TestSturdyRef.Reader> {
|
||||
|
||||
Throwable networkException;
|
||||
Connection partner;
|
||||
final Queue<IncomingRpcMessage> messages = new ArrayDeque<>();
|
||||
final Queue<CompletableFuture<IncomingRpcMessage>> fulfillers = new ArrayDeque<>();
|
||||
CompletableFuture<java.lang.Void> fulfillOnEnd;
|
||||
final boolean isClient;
|
||||
final Test.TestSturdyRef.Reader peerId;
|
||||
|
||||
Connection(boolean isClient, Test.TestSturdyRef.Reader peerId) {
|
||||
this.isClient = isClient;
|
||||
this.peerId = peerId;
|
||||
}
|
||||
|
||||
void attach(Connection other) {
|
||||
Assert.assertNull(this.partner);
|
||||
Assert.assertNull(other.partner);
|
||||
this.partner = other;
|
||||
other.partner = this;
|
||||
}
|
||||
|
||||
TestNetwork getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutgoingRpcMessage newOutgoingMessage(int firstSegmentWordSize) {
|
||||
var message = new MessageBuilder(firstSegmentWordSize);
|
||||
|
||||
return new OutgoingRpcMessage() {
|
||||
@Override
|
||||
public AnyPointer.Builder getBody() {
|
||||
return message.getRoot(AnyPointer.factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
if (networkException != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var incomingMessage = new IncomingRpcMessage() {
|
||||
@Override
|
||||
public AnyPointer.Reader getBody() {
|
||||
return message.getRoot(AnyPointer.factory).asReader();
|
||||
}
|
||||
};
|
||||
|
||||
if (partner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.fulfillers.isEmpty()) {
|
||||
partner.messages.add(incomingMessage);
|
||||
}
|
||||
else {
|
||||
partner.getNetwork().received++;
|
||||
var front = partner.fulfillers.remove();
|
||||
front.complete(incomingMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeInWords() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<IncomingRpcMessage> receiveIncomingMessage() {
|
||||
if (this.networkException != null) {
|
||||
return CompletableFuture.failedFuture(this.networkException);
|
||||
}
|
||||
|
||||
if (this.messages.isEmpty()) {
|
||||
if (this.fulfillOnEnd != null) {
|
||||
this.fulfillOnEnd.complete(null);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
else {
|
||||
var promise = new CompletableFuture<IncomingRpcMessage>();
|
||||
this.fulfillers.add(promise);
|
||||
return promise.copy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.getNetwork().received++;
|
||||
var result = this.messages.remove();
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<java.lang.Void> onDisconnect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<java.lang.Void> shutdown() {
|
||||
if (this.partner == null) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
var promise = new CompletableFuture<java.lang.Void>();
|
||||
this.partner.fulfillOnEnd = promise;
|
||||
return promise.copy();
|
||||
}
|
||||
|
||||
public Test.TestSturdyRef.Reader getPeerVatId() {
|
||||
return this.peerId;
|
||||
}
|
||||
}
|
||||
|
||||
final TestNetwork network;
|
||||
private final String self;
|
||||
int sent = 0;
|
||||
int received = 0;
|
||||
Map<TestNetworkAdapter, Connection> connections = new HashMap<>();
|
||||
Queue<CompletableFuture<Connection>> fulfillerQueue = new ArrayDeque<>();
|
||||
Queue<Connection> connectionQueue = new ArrayDeque<>();
|
||||
|
||||
TestNetworkAdapter(TestNetwork network, String self) {
|
||||
this.network = network;
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
Connection newConnection(boolean isClient, Test.TestSturdyRef.Reader peerId) {
|
||||
return new Connection(isClient, peerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VatNetwork.Connection<Test.TestSturdyRef.Reader> connect(Test.TestSturdyRef.Reader refId) {
|
||||
var hostId = refId.getHostId().getHost().toString();
|
||||
if (hostId.equals(self)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var dst = this.network.find(hostId);
|
||||
Assert.assertNotNull(dst);
|
||||
|
||||
var connnection = this.connections.get(dst);
|
||||
if (connnection != null) {
|
||||
return connnection;
|
||||
}
|
||||
|
||||
var local = this.newConnection(true, refId);
|
||||
var remote = dst.newConnection(false, refId);
|
||||
local.attach(remote);
|
||||
|
||||
this.connections.put(dst, local);
|
||||
dst.connections.put(this, remote);
|
||||
|
||||
if (dst.fulfillerQueue.isEmpty()) {
|
||||
dst.fulfillerQueue.add(CompletableFuture.completedFuture(remote));
|
||||
} else {
|
||||
dst.fulfillerQueue.remove().complete(remote);
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
||||
public CompletableFuture<Connection> accept() {
|
||||
if (this.connections.isEmpty()) {
|
||||
var promise = new CompletableFuture<Connection>();
|
||||
this.fulfillerQueue.add(promise);
|
||||
return promise.thenApply(conn -> conn);
|
||||
}
|
||||
else {
|
||||
return CompletableFuture.completedFuture(this.connectionQueue.remove());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class TestContext {
|
||||
final TestNetwork network = new TestNetwork();
|
||||
final TestNetworkAdapter clientNetwork;
|
||||
final TestNetworkAdapter serverNetwork;
|
||||
|
||||
final RpcSystem<Test.TestSturdyRef.Reader> rpcClient;
|
||||
final RpcSystem<Test.TestSturdyRef.Reader> rpcServer;
|
||||
|
||||
TestContext(Capability.Client bootstrapInterface) {
|
||||
this.clientNetwork = this.network.add("client");
|
||||
this.serverNetwork = this.network.add("server");
|
||||
this.rpcClient = RpcSystem.makeRpcClient(this.clientNetwork);
|
||||
this.rpcServer = RpcSystem.makeRpcServer(this.serverNetwork, bootstrapInterface);
|
||||
}
|
||||
|
||||
TestContext(BootstrapFactory<Test.TestSturdyRef.Reader> bootstrapFactory) {
|
||||
this.clientNetwork = this.network.add("client");
|
||||
this.serverNetwork = this.network.add("server");
|
||||
this.rpcClient = RpcSystem.makeRpcClient(this.clientNetwork);
|
||||
this.rpcServer = RpcSystem.makeRpcServer(this.serverNetwork, bootstrapFactory);
|
||||
}
|
||||
|
||||
Capability.Client connect(Test.TestSturdyRefObjectId.Tag tag) {
|
||||
var message = new MessageBuilder();
|
||||
var ref = message.initRoot(Test.TestSturdyRef.factory);
|
||||
var hostId = ref.initHostId();
|
||||
hostId.setHost("server");
|
||||
ref.getObjectId().initAs(Test.TestSturdyRefObjectId.factory).setTag(tag);
|
||||
return rpcClient.bootstrap(ref.asReader());
|
||||
}
|
||||
}
|
||||
|
||||
static BootstrapFactory<Test.TestSturdyRef.Reader> bootstrapFactory = new BootstrapFactory<>() {
|
||||
@Override
|
||||
public FromPointerReader<Test.TestSturdyRef.Reader> getVatIdFactory() {
|
||||
return Test.TestSturdyRef.factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Capability.Client createFor(Test.TestSturdyRef.Reader refId) {
|
||||
var callCount = new Counter();
|
||||
var handleCount = new Counter();
|
||||
|
||||
var objectId = refId.getObjectId().getAs(Test.TestSturdyRefObjectId.factory);
|
||||
var tag = objectId.getTag();
|
||||
switch (tag) {
|
||||
case TEST_INTERFACE:
|
||||
return new Capability.Client(new TestUtil.TestInterfaceImpl(callCount));
|
||||
case TEST_EXTENDS:
|
||||
return new Capability.Client(Capability.newBrokenCap("No TestExtends implemented."));
|
||||
case TEST_PIPELINE:
|
||||
return new Capability.Client(new TestUtil.TestPipelineImpl(callCount));
|
||||
case TEST_TAIL_CALLEE:
|
||||
return new Capability.Client(new TestUtil.TestTailCalleeImpl(callCount));
|
||||
case TEST_TAIL_CALLER:
|
||||
return new Capability.Client(new TestUtil.TestTailCallerImpl(callCount));
|
||||
case TEST_MORE_STUFF:
|
||||
return new Capability.Client(new TestUtil.TestMoreStuffImpl(callCount, handleCount));
|
||||
default:
|
||||
return new Capability.Client();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@org.junit.Test
|
||||
public void testBasic() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestInterface.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_INTERFACE));
|
||||
var request1 = client.fooRequest();
|
||||
request1.getParams().setI(123);
|
||||
request1.getParams().setJ(true);
|
||||
var promise1 = request1.send();
|
||||
|
||||
final var ref = new Object() {
|
||||
boolean barFailed = false;
|
||||
};
|
||||
var request3 = client.barRequest();
|
||||
var promise3 = request3.send().exceptionally(exc -> {
|
||||
ref.barFailed = true;
|
||||
return null;
|
||||
});
|
||||
|
||||
var request2 = client.bazRequest();
|
||||
TestUtil.initTestMessage(request2.getParams().initS());
|
||||
var promise2 = request2.send();
|
||||
|
||||
var response1 = promise1.join();
|
||||
Assert.assertEquals("foo", response1.getX().toString());
|
||||
|
||||
var response2 = promise2.join();
|
||||
promise3.join();
|
||||
|
||||
Assert.assertTrue(ref.barFailed);
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testPipelining() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestPipeline.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_PIPELINE));
|
||||
|
||||
var chainedCallCount = new Counter();
|
||||
|
||||
var request = client.getCapRequest();
|
||||
request.getParams().setN(234);
|
||||
request.getParams().setInCap(new TestUtil.TestInterfaceImpl(chainedCallCount));
|
||||
|
||||
var promise = request.send();
|
||||
|
||||
var pipelineRequest = promise.getOutBox().getCap().fooRequest();
|
||||
pipelineRequest.getParams().setI(321);
|
||||
|
||||
var pipelinePromise = pipelineRequest.send();
|
||||
|
||||
var pipelineRequest2 = new Test.TestExtends.Client(promise.getOutBox().getCap()).graultRequest();
|
||||
var pipelinePromise2 = pipelineRequest2.send();
|
||||
|
||||
promise = null;
|
||||
|
||||
//Assert.assertEquals(0, chainedCallCount.value());
|
||||
|
||||
var response = pipelinePromise.join();
|
||||
Assert.assertEquals("bar", response.getX().toString());
|
||||
|
||||
var response2 = pipelinePromise2.join();
|
||||
TestUtil.checkTestMessage(response2);
|
||||
|
||||
Assert.assertEquals(1, chainedCallCount.value());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testRelease() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestMoreStuff.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_MORE_STUFF));
|
||||
|
||||
var handle1 = client.getHandleRequest().send().join().getHandle();
|
||||
var promise = client.getHandleRequest().send();
|
||||
var handle2 = promise.join().getHandle();
|
||||
|
||||
handle1 = null;
|
||||
handle2 = null;
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testPromiseResolve() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestMoreStuff.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_MORE_STUFF));
|
||||
|
||||
var chainedCallCount = new Counter();
|
||||
|
||||
var request = client.callFooRequest();
|
||||
var request2 = client.callFooWhenResolvedRequest();
|
||||
|
||||
var paf = new CompletableFuture<Test.TestInterface.Client>();
|
||||
|
||||
{
|
||||
request.getParams().setCap(new Test.TestInterface.Client(paf.copy()));
|
||||
request2.getParams().setCap(new Test.TestInterface.Client(paf.copy()));
|
||||
}
|
||||
|
||||
var promise = request.send();
|
||||
var promise2 = request2.send();
|
||||
|
||||
// Make sure getCap() has been called on the server side by sending another call and waiting
|
||||
// for it.
|
||||
Assert.assertEquals(2, client.getCallSequenceRequest().send().join().getN());
|
||||
//Assert.assertEquals(3, context.restorer.callCount);
|
||||
|
||||
// OK, now fulfill the local promise.
|
||||
paf.complete(new Test.TestInterface.Client(new TestUtil.TestInterfaceImpl(chainedCallCount)));
|
||||
|
||||
// We should now be able to wait for getCap() to finish.
|
||||
Assert.assertEquals("bar", promise.join().getS().toString());
|
||||
Assert.assertEquals("bar", promise2.join().getS().toString());
|
||||
|
||||
//Assert.assertEquals(3, context.restorer.callCount);
|
||||
Assert.assertEquals(2, chainedCallCount.value());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,16 @@
|
|||
package org.capnproto;
|
||||
|
||||
import org.capnproto.CallContext;
|
||||
import org.capnproto.Capability;
|
||||
import org.capnproto.Void;
|
||||
import org.capnproto.test.Test;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
class TestUtil {
|
||||
|
||||
|
||||
static void initTestMessage(Test.TestAllTypes.Builder builder) {
|
||||
builder.setVoidField(Void.VOID);
|
||||
builder.setBoolField(true);
|
||||
|
@ -54,7 +59,7 @@ class TestUtil {
|
|||
Assert.assertEquals(123, params.getI());
|
||||
Assert.assertTrue(params.getJ());
|
||||
result.setX("foo");
|
||||
return READY_NOW;
|
||||
return Capability.Server.READY_NOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +68,7 @@ class TestUtil {
|
|||
var params = context.getParams();
|
||||
checkTestMessage(params.getS());
|
||||
context.releaseParams();
|
||||
return READY_NOW;
|
||||
return Capability.Server.READY_NOW;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,14 +117,14 @@ class TestUtil {
|
|||
@Override
|
||||
protected CompletableFuture<java.lang.Void> getHandle(CallContext<Test.TestMoreStuff.GetHandleParams.Reader, Test.TestMoreStuff.GetHandleResults.Builder> context) {
|
||||
context.getResults().setHandle(new HandleImpl(this.handleCount));
|
||||
return READY_NOW;
|
||||
return Capability.Server.READY_NOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompletableFuture<java.lang.Void> getCallSequence(CallContext<Test.TestCallOrder.GetCallSequenceParams.Reader, Test.TestCallOrder.GetCallSequenceResults.Builder> context) {
|
||||
var result = context.getResults();
|
||||
result.setN(this.callCount.inc());
|
||||
return READY_NOW;
|
||||
return Capability.Server.READY_NOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +179,7 @@ class TestUtil {
|
|||
results.setI(params.getI());
|
||||
results.setT(params.getT());
|
||||
results.setC(new TestCallOrderImpl());
|
||||
return READY_NOW;
|
||||
return Capability.Server.READY_NOW;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
package org.capnproto;
|
||||
/*
|
||||
import org.capnproto.demo.Demo;
|
||||
import org.junit.After;
|
||||
|
@ -42,7 +41,7 @@ class TestCap0Impl extends Demo.TestCap0.Server {
|
|||
class TestCap1Impl extends Demo.TestCap1.Server {
|
||||
}
|
||||
|
||||
class Tap implements TwoPartyVatNetwork.MessageTap {
|
||||
class Tap implements org.capnproto.TwoPartyVatNetwork.MessageTap {
|
||||
|
||||
final RpcDumper dumper = new RpcDumper();
|
||||
|
||||
|
@ -57,7 +56,7 @@ class Tap implements TwoPartyVatNetwork.MessageTap {
|
|||
|
||||
public class TwoPartyTest {
|
||||
|
||||
private Thread runServer(TwoPartyVatNetwork network) {
|
||||
private Thread runServer(org.capnproto.TwoPartyVatNetwork network) {
|
||||
var thread = new Thread(() -> {
|
||||
try {
|
||||
network.onDisconnect().get();
|
||||
|
@ -75,7 +74,7 @@ public class TwoPartyTest {
|
|||
AsynchronousServerSocketChannel serverSocket;
|
||||
AsynchronousSocketChannel clientSocket;
|
||||
TwoPartyClient client;
|
||||
TwoPartyVatNetwork serverNetwork;
|
||||
org.capnproto.TwoPartyVatNetwork serverNetwork;
|
||||
Thread serverThread;
|
||||
|
||||
@Before
|
||||
|
@ -89,7 +88,7 @@ public class TwoPartyTest {
|
|||
this.client.getNetwork().setTap(new Tap());
|
||||
|
||||
var socket = serverSocket.accept().get();
|
||||
this.serverNetwork = new TwoPartyVatNetwork(socket, RpcTwoPartyProtocol.Side.SERVER);
|
||||
this.serverNetwork = new org.capnproto.TwoPartyVatNetwork(socket, RpcTwoPartyProtocol.Side.SERVER);
|
||||
this.serverNetwork.setTap(new Tap());
|
||||
//this.serverNetwork.dumper.addSchema(Demo.TestCap1);
|
||||
this.serverThread = runServer(this.serverNetwork);
|
|
@ -44,12 +44,6 @@
|
|||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.capnproto</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
<version>0.1.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
|
|
@ -25,38 +25,4 @@ final class PipelineOp {
|
|||
return new PipelineOp(Type.GET_POINTER_FIELD, pointerIndex);
|
||||
}
|
||||
|
||||
static void FromPipelineOps(PipelineOp[] ops, RpcProtocol.PromisedAnswer.Builder builder) {
|
||||
var transforms = builder.initTransform(ops.length);
|
||||
for (int ii = 0; ii < ops.length; ++ii) {
|
||||
switch (ops[ii].type) {
|
||||
case NOOP:
|
||||
transforms.get(ii).setNoop(null);
|
||||
break;
|
||||
case GET_POINTER_FIELD:
|
||||
transforms.get(ii).setGetPointerField(ops[ii].pointerIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PipelineOp[] ToPipelineOps(RpcProtocol.PromisedAnswer.Reader reader) {
|
||||
var transforms = reader.getTransform();
|
||||
var ops = new PipelineOp[transforms.size()];
|
||||
for (int ii = 0; ii < ops.length; ++ii) {
|
||||
var transform = transforms.get(ii);
|
||||
switch (transform.which()) {
|
||||
case NOOP:
|
||||
ops[ii] = Noop(); // TODO null?
|
||||
break;
|
||||
case GET_POINTER_FIELD:
|
||||
ops[ii] = PointerField(transform.getGetPointerField());
|
||||
break;
|
||||
default:
|
||||
// TODO improve error handling here
|
||||
// Unsupported pipeline ops
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return ops;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,27 +31,4 @@ public final class RpcException extends java.lang.Exception {
|
|||
public static RpcException disconnected(String message) {
|
||||
return new RpcException(Type.DISCONNECTED, message);
|
||||
}
|
||||
|
||||
static void fromException(Throwable exc, RpcProtocol.Exception.Builder builder) {
|
||||
builder.setReason(exc.getMessage());
|
||||
builder.setType(RpcProtocol.Exception.Type.FAILED);
|
||||
}
|
||||
|
||||
static RpcException toException(RpcProtocol.Exception.Reader reader) {
|
||||
var type = RpcException.Type.UNKNOWN;
|
||||
|
||||
switch (reader.getType()) {
|
||||
case UNIMPLEMENTED:
|
||||
type = RpcException.Type.UNIMPLEMENTED;
|
||||
break;
|
||||
case FAILED:
|
||||
type = RpcException.Type.FAILED;
|
||||
break;
|
||||
case DISCONNECTED:
|
||||
case OVERLOADED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new RpcException(type, reader.getReason().toString());
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,662 +0,0 @@
|
|||
// Generated by Cap'n Proto compiler, DO NOT EDIT
|
||||
// source: rpc-twoparty.capnp
|
||||
|
||||
package org.capnproto;
|
||||
|
||||
public final class RpcTwoPartyProtocol {
|
||||
public enum Side {
|
||||
SERVER,
|
||||
CLIENT,
|
||||
_NOT_IN_SCHEMA,
|
||||
}
|
||||
|
||||
public static class VatId {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return VatId.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
public final org.capnproto.RpcTwoPartyProtocol.Side getSide() {
|
||||
switch(_getShortField(0)) {
|
||||
case 0 : return org.capnproto.RpcTwoPartyProtocol.Side.SERVER;
|
||||
case 1 : return org.capnproto.RpcTwoPartyProtocol.Side.CLIENT;
|
||||
default: return org.capnproto.RpcTwoPartyProtocol.Side._NOT_IN_SCHEMA;
|
||||
}
|
||||
}
|
||||
public final void setSide(org.capnproto.RpcTwoPartyProtocol.Side value) {
|
||||
_setShortField(0, (short)value.ordinal());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
public final org.capnproto.RpcTwoPartyProtocol.Side getSide() {
|
||||
switch(_getShortField(0)) {
|
||||
case 0 : return org.capnproto.RpcTwoPartyProtocol.Side.SERVER;
|
||||
case 1 : return org.capnproto.RpcTwoPartyProtocol.Side.CLIENT;
|
||||
default: return org.capnproto.RpcTwoPartyProtocol.Side._NOT_IN_SCHEMA;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class ProvisionId {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return ProvisionId.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
public final void setJoinId(int value) {
|
||||
_setIntField(0, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class RecipientId {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return RecipientId.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class ThirdPartyCapId {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return ThirdPartyCapId.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class JoinKeyPart {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return JoinKeyPart.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
public final void setJoinId(int value) {
|
||||
_setIntField(0, value);
|
||||
}
|
||||
|
||||
public final short getPartCount() {
|
||||
return _getShortField(2);
|
||||
}
|
||||
public final void setPartCount(short value) {
|
||||
_setShortField(2, value);
|
||||
}
|
||||
|
||||
public final short getPartNum() {
|
||||
return _getShortField(3);
|
||||
}
|
||||
public final void setPartNum(short value) {
|
||||
_setShortField(3, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
|
||||
public final short getPartCount() {
|
||||
return _getShortField(2);
|
||||
}
|
||||
|
||||
public final short getPartNum() {
|
||||
return _getShortField(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class JoinResult {
|
||||
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 Factory() {
|
||||
}
|
||||
public final Reader constructReader(org.capnproto.SegmentReader segment, int data,int pointers, int dataSize, short pointerCount, int nestingLimit) {
|
||||
return new Reader(segment,data,pointers,dataSize,pointerCount,nestingLimit);
|
||||
}
|
||||
public final Builder constructBuilder(org.capnproto.SegmentBuilder segment, int data,int pointers, int dataSize, short pointerCount) {
|
||||
return new Builder(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final org.capnproto.StructSize structSize() {
|
||||
return JoinResult.STRUCT_SIZE;
|
||||
}
|
||||
public final Reader asReader(Builder builder) {
|
||||
return builder.asReader();
|
||||
}
|
||||
}
|
||||
public static final Factory factory = new Factory();
|
||||
public static final org.capnproto.StructList.Factory<Builder,Reader> listFactory =
|
||||
new org.capnproto.StructList.Factory<Builder, Reader>(factory);
|
||||
public static final class Builder extends org.capnproto.StructBuilder {
|
||||
Builder(org.capnproto.SegmentBuilder segment, int data, int pointers,int dataSize, short pointerCount){
|
||||
super(segment, data, pointers, dataSize, pointerCount);
|
||||
}
|
||||
public final Reader asReader() {
|
||||
return new Reader(segment, data, pointers, dataSize, pointerCount, 0x7fffffff);
|
||||
}
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
public final void setJoinId(int value) {
|
||||
_setIntField(0, value);
|
||||
}
|
||||
|
||||
public final boolean getSucceeded() {
|
||||
return _getBooleanField(32);
|
||||
}
|
||||
public final void setSucceeded(boolean value) {
|
||||
_setBooleanField(32, value);
|
||||
}
|
||||
|
||||
public final boolean hasCap() {
|
||||
return !_pointerFieldIsNull(0);
|
||||
}
|
||||
public org.capnproto.AnyPointer.Builder getCap() {
|
||||
return _getPointerField(org.capnproto.AnyPointer.factory, 0);
|
||||
}
|
||||
public org.capnproto.AnyPointer.Builder initCap() {
|
||||
return _initPointerField(org.capnproto.AnyPointer.factory, 0, 0);
|
||||
}
|
||||
public org.capnproto.AnyPointer.Builder initCap(int size) {
|
||||
return _initPointerField(org.capnproto.AnyPointer.factory, 0, size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final class Reader extends org.capnproto.StructReader {
|
||||
Reader(org.capnproto.SegmentReader segment, int data, int pointers,int dataSize, short pointerCount, int nestingLimit){
|
||||
super(segment, data, pointers, dataSize, pointerCount, nestingLimit);
|
||||
}
|
||||
|
||||
public final int getJoinId() {
|
||||
return _getIntField(0);
|
||||
}
|
||||
|
||||
public final boolean getSucceeded() {
|
||||
return _getBooleanField(32);
|
||||
}
|
||||
|
||||
public boolean hasCap() {
|
||||
return !_pointerFieldIsNull(0);
|
||||
}
|
||||
public org.capnproto.AnyPointer.Reader getCap() {
|
||||
return _getPointerField(org.capnproto.AnyPointer.factory, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final class Schemas {
|
||||
public static final org.capnproto.SegmentReader b_9fd69ebc87b9719c =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u009c\u0071\u00b9\u0087\u00bc\u009e\u00d6\u009f" +
|
||||
"\u0037\u0000\u0000\u0000\u0002\u0000\u0000\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u00e2\u0001\u0000\u0000" +
|
||||
"\u0031\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u002d\u0000\u0000\u0000\u0037\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u0053" +
|
||||
"\u0069\u0064\u0065\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u0008\u0000\u0000\u0000\u0001\u0000\u0002\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0011\u0000\u0000\u0000\u003a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0009\u0000\u0000\u0000\u003a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0073\u0065\u0072\u0076\u0065\u0072\u0000\u0000" +
|
||||
"\u0063\u006c\u0069\u0065\u006e\u0074\u0000\u0000" + "");
|
||||
public static final org.capnproto.SegmentReader b_d20b909fee733a8e =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u008e\u003a\u0073\u00ee\u009f\u0090\u000b\u00d2" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0007\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\u003f\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u0056" +
|
||||
"\u0061\u0074\u0049\u0064\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u0004\u0000\u0000\u0000\u0003\u0000\u0004\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\r\u0000\u0000\u0000\u002a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0008\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0014\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u0073\u0069\u0064\u0065\u0000\u0000\u0000\u0000" +
|
||||
"\u000f\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u009c\u0071\u00b9\u0087\u00bc\u009e\u00d6\u009f" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u000f\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_b88d09a9c5f39817 =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u0017\u0098\u00f3\u00c5\u00a9\u0009\u008d\u00b8" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u001a\u0002\u0000\u0000" +
|
||||
"\u0035\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0031\u0000\u0000\u0000\u003f\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u0050" +
|
||||
"\u0072\u006f\u0076\u0069\u0073\u0069\u006f\u006e" +
|
||||
"\u0049\u0064\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u0004\u0000\u0000\u0000\u0003\u0000\u0004\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\r\u0000\u0000\u0000\u003a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0008\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0014\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u006a\u006f\u0069\u006e\u0049\u0064\u0000\u0000" +
|
||||
"\u0008\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0008\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_89f389b6fd4082c1 =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u00c1\u0082\u0040\u00fd\u00b6\u0089\u00f3\u0089" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0000\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u001a\u0002\u0000\u0000" +
|
||||
"\u0035\u0000\u0000\u0000\u0007\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" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u0052" +
|
||||
"\u0065\u0063\u0069\u0070\u0069\u0065\u006e\u0074" +
|
||||
"\u0049\u0064\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" + "");
|
||||
public static final org.capnproto.SegmentReader b_b47f4979672cb59d =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u009d\u00b5\u002c\u0067\u0079\u0049\u007f\u00b4" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0000\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u003a\u0002\u0000\u0000" +
|
||||
"\u0035\u0000\u0000\u0000\u0007\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" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u0054" +
|
||||
"\u0068\u0069\u0072\u0064\u0050\u0061\u0072\u0074" +
|
||||
"\u0079\u0043\u0061\u0070\u0049\u0064\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" + "");
|
||||
public static final org.capnproto.SegmentReader b_95b29059097fca83 =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u0083\u00ca\u007f\u0009\u0059\u0090\u00b2\u0095" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u001a\u0002\u0000\u0000" +
|
||||
"\u0035\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0031\u0000\u0000\u0000\u00af\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u004a" +
|
||||
"\u006f\u0069\u006e\u004b\u0065\u0079\u0050\u0061" +
|
||||
"\u0072\u0074\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u000c\u0000\u0000\u0000\u0003\u0000\u0004\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0045\u0000\u0000\u0000\u003a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0040\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u004c\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u0001\u0000\u0000\u0000\u0002\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0049\u0000\u0000\u0000\u0052\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0048\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0054\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u0002\u0000\u0000\u0000\u0003\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0002\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0051\u0000\u0000\u0000\u0042\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u004c\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0058\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u006a\u006f\u0069\u006e\u0049\u0064\u0000\u0000" +
|
||||
"\u0008\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0070\u0061\u0072\u0074\u0043\u006f\u0075\u006e" +
|
||||
"\u0074\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0007\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0070\u0061\u0072\u0074\u004e\u0075\u006d\u0000" +
|
||||
"\u0007\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0007\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_9d263a3630b7ebee =
|
||||
org.capnproto.GeneratedClassSupport.decodeRawBytes(
|
||||
"\u0000\u0000\u0000\u0000\u0005\u0000\u0006\u0000" +
|
||||
"\u00ee\u00eb\u00b7\u0030\u0036\u003a\u0026\u009d" +
|
||||
"\u0037\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u00a1\u00f2\u00da\\\u0088\u00c7\u0084\u00a1" +
|
||||
"\u0001\u0000\u0007\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0015\u0000\u0000\u0000\u0012\u0002\u0000\u0000" +
|
||||
"\u0035\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0031\u0000\u0000\u0000\u00af\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0072\u0075\u006e\u0074\u0069\u006d\u0065\u002f" +
|
||||
"\u0073\u0072\u0063\u002f\u006d\u0061\u0069\u006e" +
|
||||
"\u002f\u006a\u0061\u0076\u0061\u002f\u006f\u0072" +
|
||||
"\u0067\u002f\u0063\u0061\u0070\u006e\u0070\u0072" +
|
||||
"\u006f\u0074\u006f\u002f\u0072\u0070\u0063\u002d" +
|
||||
"\u0074\u0077\u006f\u0070\u0061\u0072\u0074\u0079" +
|
||||
"\u002e\u0063\u0061\u0070\u006e\u0070\u003a\u004a" +
|
||||
"\u006f\u0069\u006e\u0052\u0065\u0073\u0075\u006c" +
|
||||
"\u0074\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0001\u0000\u0001\u0000" +
|
||||
"\u000c\u0000\u0000\u0000\u0003\u0000\u0004\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0045\u0000\u0000\u0000\u003a\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0040\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u004c\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u0001\u0000\u0000\u0000\u0020\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0001\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0049\u0000\u0000\u0000\u0052\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0048\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0054\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0001\u0000\u0002\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0051\u0000\u0000\u0000\"\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u004c\u0000\u0000\u0000\u0003\u0000\u0001\u0000" +
|
||||
"\u0058\u0000\u0000\u0000\u0002\u0000\u0001\u0000" +
|
||||
"\u006a\u006f\u0069\u006e\u0049\u0064\u0000\u0000" +
|
||||
"\u0008\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0073\u0075\u0063\u0063\u0065\u0065\u0064\u0065" +
|
||||
"\u0064\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0001\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0063\u0061\u0070\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0012\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\u0000\u0000\u0000\u0000" +
|
||||
"\u0012\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + "");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,410 +0,0 @@
|
|||
// Copyright (c) 2018 Sandstorm Development Group, Inc. and contributors
|
||||
// Licensed under the MIT License:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
package org.capnproto;
|
||||
|
||||
import org.capnproto.test.Test;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
class TestNetwork {
|
||||
|
||||
final Map<String, TestNetworkAdapter> map = new HashMap<>();
|
||||
int received = 0;
|
||||
|
||||
TestNetworkAdapter add(String name) {
|
||||
return this.map.computeIfAbsent(
|
||||
name, key -> new TestNetworkAdapter(this, name));
|
||||
}
|
||||
|
||||
TestNetworkAdapter find(String name) {
|
||||
return this.map.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
class TestNetworkAdapter
|
||||
implements VatNetwork<Test.TestSturdyRef.Reader> {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<VatNetwork.Connection<Test.TestSturdyRef.Reader>> baseAccept() {
|
||||
return this.accept().thenApply(conn -> conn);
|
||||
}
|
||||
|
||||
class Connection implements VatNetwork.Connection<Test.TestSturdyRef.Reader> {
|
||||
|
||||
Throwable networkException;
|
||||
Connection partner;
|
||||
final Queue<IncomingRpcMessage> messages = new ArrayDeque<>();
|
||||
final Queue<CompletableFuture<IncomingRpcMessage>> fulfillers = new ArrayDeque<>();
|
||||
CompletableFuture<java.lang.Void> fulfillOnEnd;
|
||||
final boolean isClient;
|
||||
final Test.TestSturdyRef.Reader peerId;
|
||||
|
||||
Connection(boolean isClient, Test.TestSturdyRef.Reader peerId) {
|
||||
this.isClient = isClient;
|
||||
this.peerId = peerId;
|
||||
}
|
||||
|
||||
void attach(Connection other) {
|
||||
Assert.assertNull(this.partner);
|
||||
Assert.assertNull(other.partner);
|
||||
this.partner = other;
|
||||
other.partner = this;
|
||||
}
|
||||
|
||||
TestNetwork getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutgoingRpcMessage newOutgoingMessage(int firstSegmentWordSize) {
|
||||
var message = new MessageBuilder(firstSegmentWordSize);
|
||||
|
||||
return new OutgoingRpcMessage() {
|
||||
@Override
|
||||
public AnyPointer.Builder getBody() {
|
||||
return message.getRoot(AnyPointer.factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
if (networkException != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var incomingMessage = new IncomingRpcMessage() {
|
||||
@Override
|
||||
public AnyPointer.Reader getBody() {
|
||||
return message.getRoot(AnyPointer.factory).asReader();
|
||||
}
|
||||
};
|
||||
|
||||
if (partner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.fulfillers.isEmpty()) {
|
||||
partner.messages.add(incomingMessage);
|
||||
}
|
||||
else {
|
||||
partner.getNetwork().received++;
|
||||
var front = partner.fulfillers.remove();
|
||||
front.complete(incomingMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeInWords() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<IncomingRpcMessage> receiveIncomingMessage() {
|
||||
if (this.networkException != null) {
|
||||
return CompletableFuture.failedFuture(this.networkException);
|
||||
}
|
||||
|
||||
if (this.messages.isEmpty()) {
|
||||
if (this.fulfillOnEnd != null) {
|
||||
this.fulfillOnEnd.complete(null);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
else {
|
||||
var promise = new CompletableFuture<IncomingRpcMessage>();
|
||||
this.fulfillers.add(promise);
|
||||
return promise.copy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.getNetwork().received++;
|
||||
var result = this.messages.remove();
|
||||
return CompletableFuture.completedFuture(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<java.lang.Void> onDisconnect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<java.lang.Void> shutdown() {
|
||||
if (this.partner == null) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
var promise = new CompletableFuture<java.lang.Void>();
|
||||
this.partner.fulfillOnEnd = promise;
|
||||
return promise.copy();
|
||||
}
|
||||
|
||||
public Test.TestSturdyRef.Reader getPeerVatId() {
|
||||
return this.peerId;
|
||||
}
|
||||
}
|
||||
|
||||
final TestNetwork network;
|
||||
private final String self;
|
||||
int sent = 0;
|
||||
int received = 0;
|
||||
Map<TestNetworkAdapter, Connection> connections = new HashMap<>();
|
||||
Queue<CompletableFuture<Connection>> fulfillerQueue = new ArrayDeque<>();
|
||||
Queue<Connection> connectionQueue = new ArrayDeque<>();
|
||||
|
||||
TestNetworkAdapter(TestNetwork network, String self) {
|
||||
this.network = network;
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
Connection newConnection(boolean isClient, Test.TestSturdyRef.Reader peerId) {
|
||||
return new Connection(isClient, peerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VatNetwork.Connection<Test.TestSturdyRef.Reader> connect(Test.TestSturdyRef.Reader refId) {
|
||||
var hostId = refId.getHostId().getHost().toString();
|
||||
if (hostId.equals(self)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var dst = this.network.find(hostId);
|
||||
Assert.assertNotNull(dst);
|
||||
|
||||
var connnection = this.connections.get(dst);
|
||||
if (connnection != null) {
|
||||
return connnection;
|
||||
}
|
||||
|
||||
var local = this.newConnection(true, refId);
|
||||
var remote = dst.newConnection(false, refId);
|
||||
local.attach(remote);
|
||||
|
||||
this.connections.put(dst, local);
|
||||
dst.connections.put(this, remote);
|
||||
|
||||
if (dst.fulfillerQueue.isEmpty()) {
|
||||
dst.fulfillerQueue.add(CompletableFuture.completedFuture(remote));
|
||||
} else {
|
||||
dst.fulfillerQueue.remove().complete(remote);
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
||||
public CompletableFuture<Connection> accept() {
|
||||
if (this.connections.isEmpty()) {
|
||||
var promise = new CompletableFuture<Connection>();
|
||||
this.fulfillerQueue.add(promise);
|
||||
return promise.thenApply(conn -> conn);
|
||||
}
|
||||
else {
|
||||
return CompletableFuture.completedFuture(this.connectionQueue.remove());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestContext {
|
||||
final TestNetwork network = new TestNetwork();
|
||||
final TestNetworkAdapter clientNetwork;
|
||||
final TestNetworkAdapter serverNetwork;
|
||||
|
||||
final RpcSystem<Test.TestSturdyRef.Reader> rpcClient;
|
||||
final RpcSystem<Test.TestSturdyRef.Reader> rpcServer;
|
||||
|
||||
TestContext(Capability.Client bootstrapInterface) {
|
||||
this.clientNetwork = this.network.add("client");
|
||||
this.serverNetwork = this.network.add("server");
|
||||
this.rpcClient = RpcSystem.makeRpcClient(this.clientNetwork);
|
||||
this.rpcServer = RpcSystem.makeRpcServer(this.serverNetwork, bootstrapInterface);
|
||||
}
|
||||
|
||||
TestContext(BootstrapFactory<Test.TestSturdyRef.Reader> bootstrapFactory) {
|
||||
this.clientNetwork = this.network.add("client");
|
||||
this.serverNetwork = this.network.add("server");
|
||||
this.rpcClient = RpcSystem.makeRpcClient(this.clientNetwork);
|
||||
this.rpcServer = RpcSystem.makeRpcServer(this.serverNetwork, bootstrapFactory);
|
||||
}
|
||||
|
||||
Capability.Client connect(Test.TestSturdyRefObjectId.Tag tag) {
|
||||
var message = new MessageBuilder();
|
||||
var ref = message.initRoot(Test.TestSturdyRef.factory);
|
||||
var hostId = ref.initHostId();
|
||||
hostId.setHost("server");
|
||||
ref.getObjectId().initAs(Test.TestSturdyRefObjectId.factory).setTag(tag);
|
||||
return rpcClient.bootstrap(ref.asReader());
|
||||
}
|
||||
}
|
||||
|
||||
public class RpcTest {
|
||||
|
||||
static BootstrapFactory<Test.TestSturdyRef.Reader> bootstrapFactory = new BootstrapFactory<>() {
|
||||
@Override
|
||||
public FromPointerReader<Test.TestSturdyRef.Reader> getVatIdFactory() {
|
||||
return Test.TestSturdyRef.factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Capability.Client createFor(Test.TestSturdyRef.Reader refId) {
|
||||
var callCount = new Counter();
|
||||
var handleCount = new Counter();
|
||||
|
||||
var objectId = refId.getObjectId().getAs(Test.TestSturdyRefObjectId.factory);
|
||||
var tag = objectId.getTag();
|
||||
switch (tag) {
|
||||
case TEST_INTERFACE:
|
||||
return new Capability.Client(new TestUtil.TestInterfaceImpl(callCount));
|
||||
case TEST_EXTENDS:
|
||||
return new Capability.Client(Capability.newBrokenCap("No TestExtends implemented."));
|
||||
case TEST_PIPELINE:
|
||||
return new Capability.Client(new TestUtil.TestPipelineImpl(callCount));
|
||||
case TEST_TAIL_CALLEE:
|
||||
return new Capability.Client(new TestUtil.TestTailCalleeImpl(callCount));
|
||||
case TEST_TAIL_CALLER:
|
||||
return new Capability.Client(new TestUtil.TestTailCallerImpl(callCount));
|
||||
case TEST_MORE_STUFF:
|
||||
return new Capability.Client(new TestUtil.TestMoreStuffImpl(callCount, handleCount));
|
||||
default:
|
||||
return new Capability.Client();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@org.junit.Test
|
||||
public void testBasic() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestInterface.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_INTERFACE));
|
||||
var request1 = client.fooRequest();
|
||||
request1.getParams().setI(123);
|
||||
request1.getParams().setJ(true);
|
||||
var promise1 = request1.send();
|
||||
|
||||
final var ref = new Object() {
|
||||
boolean barFailed = false;
|
||||
};
|
||||
var request3 = client.barRequest();
|
||||
var promise3 = request3.send().exceptionally(exc -> {
|
||||
ref.barFailed = true;
|
||||
return null;
|
||||
});
|
||||
|
||||
var request2 = client.bazRequest();
|
||||
TestUtil.initTestMessage(request2.getParams().initS());
|
||||
var promise2 = request2.send();
|
||||
|
||||
var response1 = promise1.join();
|
||||
Assert.assertEquals("foo", response1.getX().toString());
|
||||
|
||||
var response2 = promise2.join();
|
||||
promise3.join();
|
||||
|
||||
Assert.assertTrue(ref.barFailed);
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testPipelining() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestPipeline.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_PIPELINE));
|
||||
|
||||
var chainedCallCount = new Counter();
|
||||
|
||||
var request = client.getCapRequest();
|
||||
request.getParams().setN(234);
|
||||
request.getParams().setInCap(new TestUtil.TestInterfaceImpl(chainedCallCount));
|
||||
|
||||
var promise = request.send();
|
||||
|
||||
var pipelineRequest = promise.getOutBox().getCap().fooRequest();
|
||||
pipelineRequest.getParams().setI(321);
|
||||
|
||||
var pipelinePromise = pipelineRequest.send();
|
||||
|
||||
var pipelineRequest2 = new Test.TestExtends.Client(promise.getOutBox().getCap()).graultRequest();
|
||||
var pipelinePromise2 = pipelineRequest2.send();
|
||||
|
||||
promise = null;
|
||||
|
||||
//Assert.assertEquals(0, chainedCallCount.value());
|
||||
|
||||
var response = pipelinePromise.join();
|
||||
Assert.assertEquals("bar", response.getX().toString());
|
||||
|
||||
var response2 = pipelinePromise2.join();
|
||||
TestUtil.checkTestMessage(response2);
|
||||
|
||||
Assert.assertEquals(1, chainedCallCount.value());
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testRelease() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestMoreStuff.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_MORE_STUFF));
|
||||
|
||||
var handle1 = client.getHandleRequest().send().join().getHandle();
|
||||
var promise = client.getHandleRequest().send();
|
||||
var handle2 = promise.join().getHandle();
|
||||
|
||||
handle1 = null;
|
||||
handle2 = null;
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testPromiseResolve() {
|
||||
var context = new TestContext(bootstrapFactory);
|
||||
var client = new Test.TestMoreStuff.Client(context.connect(Test.TestSturdyRefObjectId.Tag.TEST_MORE_STUFF));
|
||||
|
||||
var chainedCallCount = new Counter();
|
||||
|
||||
var request = client.callFooRequest();
|
||||
var request2 = client.callFooWhenResolvedRequest();
|
||||
|
||||
var paf = new CompletableFuture<Test.TestInterface.Client>();
|
||||
|
||||
{
|
||||
request.getParams().setCap(new Test.TestInterface.Client(paf.copy()));
|
||||
request2.getParams().setCap(new Test.TestInterface.Client(paf.copy()));
|
||||
}
|
||||
|
||||
var promise = request.send();
|
||||
var promise2 = request2.send();
|
||||
|
||||
// Make sure getCap() has been called on the server side by sending another call and waiting
|
||||
// for it.
|
||||
Assert.assertEquals(2, client.getCallSequenceRequest().send().join().getN());
|
||||
//Assert.assertEquals(3, context.restorer.callCount);
|
||||
|
||||
// OK, now fulfill the local promise.
|
||||
paf.complete(new Test.TestInterface.Client(new TestUtil.TestInterfaceImpl(chainedCallCount)));
|
||||
|
||||
// We should now be able to wait for getCap() to finish.
|
||||
Assert.assertEquals("bar", promise.join().getS().toString());
|
||||
Assert.assertEquals("bar", promise2.join().getS().toString());
|
||||
|
||||
//Assert.assertEquals(3, context.restorer.callCount);
|
||||
Assert.assertEquals(2, chainedCallCount.value());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
@0xb6577a1582e84742;
|
||||
|
||||
using Java = import "/capnp/java.capnp";
|
||||
$Java.package("org.capnproto.demo");
|
||||
$Java.outerClassname("Demo");
|
||||
|
||||
struct TestParams0 {
|
||||
param0 @0 :Int32;
|
||||
}
|
||||
|
||||
struct TestResults0 {
|
||||
result0 @0 :Int32;
|
||||
}
|
||||
|
||||
struct TestParams1 {
|
||||
param0 @0 :AnyPointer;
|
||||
}
|
||||
|
||||
struct TestResults1 {
|
||||
result0 @0 :AnyPointer;
|
||||
result1 @1 :AnyPointer;
|
||||
result2 @2 :AnyPointer;
|
||||
}
|
||||
|
||||
struct Struct0 {
|
||||
f0 @0 :Bool;
|
||||
}
|
||||
|
||||
interface Iface0 {
|
||||
method0 @0 ();
|
||||
method1 @1 () -> stream;
|
||||
}
|
||||
|
||||
struct Struct2 {
|
||||
f0 @0 :AnyPointer;
|
||||
f1i @1 :Iface0;
|
||||
}
|
||||
|
||||
interface TestCap0 {
|
||||
testMethod0 @0 TestParams0 -> TestResults0;
|
||||
testMethod1 @1 TestParams1 -> TestResults1;
|
||||
}
|
||||
|
||||
interface TestCap1 {
|
||||
}
|
||||
|
||||
|
||||
interface Iface1 {
|
||||
|
||||
struct Struct1 {
|
||||
f0 @0 :Bool;
|
||||
f1 @1 :AnyPointer;
|
||||
}
|
||||
|
||||
method0 @0 () -> (result0 :Struct0, result1 :Struct1);
|
||||
method1 @1 () -> (result0: Iface0);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,12 +0,0 @@
|
|||
@0xf29f4ba3b0a5a945;
|
||||
|
||||
using Params = import "demoparams.capnp";
|
||||
|
||||
interface TestCap0 {
|
||||
testMethod0 @0 Params.TestParams0 -> Params.TestResults0;
|
||||
testMethod1 @1 Params.TestParams1 -> Params.TestResults1;
|
||||
}
|
||||
|
||||
interface TestCap1 {
|
||||
}
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
// Generated by Cap'n Proto compiler, DO NOT EDIT
|
||||
// source: democap.capnp
|
||||
|
||||
#include "democap.capnp.h"
|
||||
|
||||
namespace capnp {
|
||||
namespace schemas {
|
||||
static const ::capnp::_::AlignedData<40> b_a65f4a3d7f622e6b = {
|
||||
{ 0, 0, 0, 0, 5, 0, 6, 0,
|
||||
107, 46, 98, 127, 61, 74, 95, 166,
|
||||
14, 0, 0, 0, 3, 0, 0, 0,
|
||||
69, 169, 165, 176, 163, 75, 159, 242,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
21, 0, 0, 0, 186, 0, 0, 0,
|
||||
29, 0, 0, 0, 7, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
25, 0, 0, 0, 135, 0, 0, 0,
|
||||
113, 0, 0, 0, 7, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
100, 101, 109, 111, 99, 97, 112, 46,
|
||||
99, 97, 112, 110, 112, 58, 84, 101,
|
||||
115, 116, 67, 97, 112, 48, 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,
|
||||
18, 240, 128, 209, 172, 180, 1, 179,
|
||||
129, 40, 181, 33, 84, 46, 164, 150,
|
||||
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,
|
||||
87, 9, 34, 182, 168, 99, 3, 225,
|
||||
62, 219, 93, 212, 228, 46, 133, 153,
|
||||
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_a65f4a3d7f622e6b = b_a65f4a3d7f622e6b.words;
|
||||
#if !CAPNP_LITE
|
||||
static const ::capnp::_::RawSchema* const d_a65f4a3d7f622e6b[] = {
|
||||
&s_96a42e5421b52881,
|
||||
&s_99852ee4d45ddb3e,
|
||||
&s_b301b4acd180f012,
|
||||
&s_e10363a8b6220957,
|
||||
};
|
||||
static const uint16_t m_a65f4a3d7f622e6b[] = {0, 1};
|
||||
const ::capnp::_::RawSchema s_a65f4a3d7f622e6b = {
|
||||
0xa65f4a3d7f622e6b, b_a65f4a3d7f622e6b.words, 40, d_a65f4a3d7f622e6b, m_a65f4a3d7f622e6b,
|
||||
4, 2, nullptr, nullptr, nullptr, { &s_a65f4a3d7f622e6b, nullptr, nullptr, 0, 0, nullptr }
|
||||
};
|
||||
#endif // !CAPNP_LITE
|
||||
static const ::capnp::_::AlignedData<18> b_81da3f8f6079c216 = {
|
||||
{ 0, 0, 0, 0, 5, 0, 6, 0,
|
||||
22, 194, 121, 96, 143, 63, 218, 129,
|
||||
14, 0, 0, 0, 3, 0, 0, 0,
|
||||
69, 169, 165, 176, 163, 75, 159, 242,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
21, 0, 0, 0, 186, 0, 0, 0,
|
||||
29, 0, 0, 0, 7, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
25, 0, 0, 0, 7, 0, 0, 0,
|
||||
25, 0, 0, 0, 7, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
100, 101, 109, 111, 99, 97, 112, 46,
|
||||
99, 97, 112, 110, 112, 58, 84, 101,
|
||||
115, 116, 67, 97, 112, 49, 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_81da3f8f6079c216 = b_81da3f8f6079c216.words;
|
||||
#if !CAPNP_LITE
|
||||
const ::capnp::_::RawSchema s_81da3f8f6079c216 = {
|
||||
0x81da3f8f6079c216, b_81da3f8f6079c216.words, 18, nullptr, nullptr,
|
||||
0, 0, nullptr, nullptr, nullptr, { &s_81da3f8f6079c216, nullptr, nullptr, 0, 0, nullptr }
|
||||
};
|
||||
#endif // !CAPNP_LITE
|
||||
} // namespace schemas
|
||||
} // namespace capnp
|
||||
|
||||
// =======================================================================================
|
||||
|
||||
|
||||
#if !CAPNP_LITE
|
||||
::capnp::Request< ::TestParams0, ::TestResults0>
|
||||
TestCap0::Client::testMethod0Request(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
|
||||
return newCall< ::TestParams0, ::TestResults0>(
|
||||
0xa65f4a3d7f622e6bull, 0, sizeHint);
|
||||
}
|
||||
::kj::Promise<void> TestCap0::Server::testMethod0(TestMethod0Context) {
|
||||
return ::capnp::Capability::Server::internalUnimplemented(
|
||||
"democap.capnp:TestCap0", "testMethod0",
|
||||
0xa65f4a3d7f622e6bull, 0);
|
||||
}
|
||||
::capnp::Request< ::TestParams1, ::TestResults1>
|
||||
TestCap0::Client::testMethod1Request(::kj::Maybe< ::capnp::MessageSize> sizeHint) {
|
||||
return newCall< ::TestParams1, ::TestResults1>(
|
||||
0xa65f4a3d7f622e6bull, 1, sizeHint);
|
||||
}
|
||||
::kj::Promise<void> TestCap0::Server::testMethod1(TestMethod1Context) {
|
||||
return ::capnp::Capability::Server::internalUnimplemented(
|
||||
"democap.capnp:TestCap0", "testMethod1",
|
||||
0xa65f4a3d7f622e6bull, 1);
|
||||
}
|
||||
::capnp::Capability::Server::DispatchCallResult TestCap0::Server::dispatchCall(
|
||||
uint64_t interfaceId, uint16_t methodId,
|
||||
::capnp::CallContext< ::capnp::AnyPointer, ::capnp::AnyPointer> context) {
|
||||
switch (interfaceId) {
|
||||
case 0xa65f4a3d7f622e6bull:
|
||||
return dispatchCallInternal(methodId, context);
|
||||
default:
|
||||
return internalUnimplemented("democap.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(
|
||||
"democap.capnp:TestCap0",
|
||||
0xa65f4a3d7f622e6bull, 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 0x81da3f8f6079c216ull:
|
||||
return dispatchCallInternal(methodId, context);
|
||||
default:
|
||||
return internalUnimplemented("democap.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(
|
||||
"democap.capnp:TestCap1",
|
||||
0x81da3f8f6079c216ull, methodId);
|
||||
}
|
||||
}
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
// TestCap1
|
||||
#if !CAPNP_LITE
|
||||
constexpr ::capnp::Kind TestCap1::_capnpPrivate::kind;
|
||||
constexpr ::capnp::_::RawSchema const* TestCap1::_capnpPrivate::schema;
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
|
||||
|
|
@ -1,216 +0,0 @@
|
|||
// Generated by Cap'n Proto compiler, DO NOT EDIT
|
||||
// source: democap.capnp
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <capnp/generated-header-support.h>
|
||||
#include <kj/windows-sanity.h>
|
||||
#if !CAPNP_LITE
|
||||
#include <capnp/capability.h>
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
#if CAPNP_VERSION != 8000
|
||||
#error "Version mismatch between generated code and library headers. You must use the same version of the Cap'n Proto compiler and library."
|
||||
#endif
|
||||
|
||||
#include "demoparams.capnp.h"
|
||||
|
||||
namespace capnp {
|
||||
namespace schemas {
|
||||
|
||||
CAPNP_DECLARE_SCHEMA(a65f4a3d7f622e6b);
|
||||
CAPNP_DECLARE_SCHEMA(81da3f8f6079c216);
|
||||
|
||||
} // namespace schemas
|
||||
} // namespace capnp
|
||||
|
||||
|
||||
struct TestCap0 {
|
||||
TestCap0() = delete;
|
||||
|
||||
#if !CAPNP_LITE
|
||||
class Client;
|
||||
class Server;
|
||||
#endif // !CAPNP_LITE
|
||||
|
||||
|
||||
#if !CAPNP_LITE
|
||||
struct _capnpPrivate {
|
||||
CAPNP_DECLARE_INTERFACE_HEADER(a65f4a3d7f622e6b)
|
||||
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(81da3f8f6079c216)
|
||||
static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; }
|
||||
};
|
||||
#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
|
||||
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
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
@0x91b57797d64253c4;
|
||||
|
||||
using Java = import "/capnp/java.capnp";
|
||||
$Java.package("org.capnproto.demo");
|
||||
$Java.outerClassname("Demo");
|
||||
|
||||
struct TestParams0 {
|
||||
param0 @0 :Int32;
|
||||
}
|
||||
|
||||
struct TestResults0 {
|
||||
result0 @0 :Int32;
|
||||
}
|
||||
|
||||
struct TestParams1 {
|
||||
param0 @0 :AnyPointer;
|
||||
}
|
||||
|
||||
struct TestResults1 {
|
||||
result0 @0 :AnyPointer;
|
||||
result1 @1 :AnyPointer;
|
||||
result2 @2 :AnyPointer;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue