Commit 860af726 authored by Kenton Varda's avatar Kenton Varda

In RPC protocol, rename request -> params, answer -> results. Also fix up Join…

In RPC protocol, rename request -> params, answer -> results.  Also fix up Join stuff in rpc-twoparty.capnp, because it was sort of wrong.
parent 3dda3cee
...@@ -58,7 +58,7 @@ private: ...@@ -58,7 +58,7 @@ private:
typedef VatNetwork< typedef VatNetwork<
test::TestSturdyRefHostId, test::TestProvisionId, test::TestRecipientId, test::TestSturdyRefHostId, test::TestProvisionId, test::TestRecipientId,
test::TestThirdPartyCapId, test::TestJoinAnswer> TestNetworkAdapterBase; test::TestThirdPartyCapId, test::TestJoinResult> TestNetworkAdapterBase;
class TestNetworkAdapter final: public TestNetworkAdapterBase { class TestNetworkAdapter final: public TestNetworkAdapterBase {
public: public:
......
...@@ -110,10 +110,40 @@ struct ThirdPartyCapId {} ...@@ -110,10 +110,40 @@ struct ThirdPartyCapId {}
# Never used, because there is no third party. # Never used, because there is no third party.
struct JoinKeyPart { 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; joinId @0 :UInt32;
# A number identifying this join, chosen by the contained app. Since the container will never # A number identifying this join, chosen by the sender. May be reused once `Finish` messages are
# issue a join _to_ the contained app, all ongoing joins across the whole (two-vat) network are # sent corresponding to all of the `Join` messages.
# uniquely identified by this ID.
partCount @1 :UInt16; partCount @1 :UInt16;
# The number of capabilities to be joined. # The number of capabilities to be joined.
...@@ -122,12 +152,17 @@ struct JoinKeyPart { ...@@ -122,12 +152,17 @@ struct JoinKeyPart {
# Which part this request targets -- a number in the range [0, partCount). # Which part this request targets -- a number in the range [0, partCount).
} }
struct JoinAnswer { struct JoinResult {
joinId @0 :UInt32; joinId @0 :UInt32;
# Matches `JoinKeyPart`. # Matches `JoinKeyPart`.
succeeded @1 :Bool; succeeded @1 :Bool;
# All JoinAnswers in the set will have the same value for `succeeded`. The container actually # 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 # 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. # them, then going back and answering all the join requests afterwards.
cap @2 :Object;
# One of the JoinResults will have a non-null `cap` which is the joined capability.
#
# TODO(cleanup): Change `Object` to `Capability` when that is supported.
} }
...@@ -237,39 +237,46 @@ const ::capnp::_::RawSchema s_95b29059097fca83 = { ...@@ -237,39 +237,46 @@ const ::capnp::_::RawSchema s_95b29059097fca83 = {
0x95b29059097fca83, b_95b29059097fca83.words, 61, nullptr, m_95b29059097fca83, 0x95b29059097fca83, b_95b29059097fca83.words, 61, nullptr, m_95b29059097fca83,
0, 3, i_95b29059097fca83, nullptr, nullptr 0, 3, i_95b29059097fca83, nullptr, nullptr
}; };
static const ::capnp::_::AlignedData<47> b_e34f40bff3af6b96 = { static const ::capnp::_::AlignedData<61> b_9d263a3630b7ebee = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
150, 107, 175, 243, 191, 64, 79, 227, 238, 235, 183, 48, 54, 58, 38, 157,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0,
161, 242, 218, 92, 136, 199, 132, 161, 161, 242, 218, 92, 136, 199, 132, 161,
0, 0, 5, 0, 0, 0, 0, 0, 1, 0, 7, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 34, 1, 0, 0, 17, 0, 0, 0, 34, 1, 0, 0,
33, 0, 0, 0, 7, 0, 0, 0, 33, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29, 0, 0, 0, 119, 0, 0, 0, 29, 0, 0, 0, 175, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 114, 112, 99, 97, 112, 110, 112, 47, 114, 112,
99, 45, 116, 119, 111, 112, 97, 114, 99, 45, 116, 119, 111, 112, 97, 114,
116, 121, 46, 99, 97, 112, 110, 112, 116, 121, 46, 99, 97, 112, 110, 112,
58, 74, 111, 105, 110, 65, 110, 115, 58, 74, 111, 105, 110, 82, 101, 115,
119, 101, 114, 0, 0, 0, 0, 0, 117, 108, 116, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0,
8, 0, 0, 0, 3, 0, 4, 0, 12, 0, 0, 0, 3, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 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, 58, 0, 0, 0, 69, 0, 0, 0, 58, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36, 0, 0, 0, 2, 0, 1, 0, 64, 0, 0, 0, 2, 0, 1, 0,
44, 0, 0, 0, 2, 0, 1, 0, 72, 0, 0, 0, 2, 0, 1, 0,
1, 0, 0, 0, 32, 0, 0, 0, 1, 0, 0, 0, 32, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41, 0, 0, 0, 82, 0, 0, 0, 69, 0, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
68, 0, 0, 0, 2, 0, 1, 0,
76, 0, 0, 0, 2, 0, 1, 0,
2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
73, 0, 0, 0, 34, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40, 0, 0, 0, 2, 0, 1, 0, 68, 0, 0, 0, 2, 0, 1, 0,
48, 0, 0, 0, 2, 0, 1, 0, 76, 0, 0, 0, 2, 0, 1, 0,
106, 111, 105, 110, 73, 100, 0, 0, 106, 111, 105, 110, 73, 100, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -283,14 +290,21 @@ static const ::capnp::_::AlignedData<47> b_e34f40bff3af6b96 = { ...@@ -283,14 +290,21 @@ static const ::capnp::_::AlignedData<47> b_e34f40bff3af6b96 = {
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, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 0, 0, 0, 0, 0,
18, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
18, 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, 0, 0, 0, 0, } 0, 0, 0, 0, 0, 0, 0, 0, }
}; };
static const uint16_t m_e34f40bff3af6b96[] = {0, 1}; static const uint16_t m_9d263a3630b7ebee[] = {2, 0, 1};
static const uint16_t i_e34f40bff3af6b96[] = {0, 1}; static const uint16_t i_9d263a3630b7ebee[] = {0, 1, 2};
const ::capnp::_::RawSchema s_e34f40bff3af6b96 = { const ::capnp::_::RawSchema s_9d263a3630b7ebee = {
0xe34f40bff3af6b96, b_e34f40bff3af6b96.words, 47, nullptr, m_e34f40bff3af6b96, 0x9d263a3630b7ebee, b_9d263a3630b7ebee.words, 61, nullptr, m_9d263a3630b7ebee,
0, 2, i_e34f40bff3af6b96, nullptr, nullptr 0, 3, i_9d263a3630b7ebee, nullptr, nullptr
}; };
} // namespace schemas } // namespace schemas
namespace _ { // private namespace _ { // private
...@@ -307,6 +321,6 @@ CAPNP_DEFINE_STRUCT( ...@@ -307,6 +321,6 @@ CAPNP_DEFINE_STRUCT(
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::rpc::twoparty::JoinKeyPart); ::capnp::rpc::twoparty::JoinKeyPart);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::rpc::twoparty::JoinAnswer); ::capnp::rpc::twoparty::JoinResult);
} // namespace _ (private) } // namespace _ (private)
} // namespace capnp } // namespace capnp
...@@ -60,8 +60,8 @@ struct JoinKeyPart { ...@@ -60,8 +60,8 @@ struct JoinKeyPart {
class Pipeline; class Pipeline;
}; };
struct JoinAnswer { struct JoinResult {
JoinAnswer() = delete; JoinResult() = delete;
class Reader; class Reader;
class Builder; class Builder;
...@@ -83,7 +83,7 @@ extern const ::capnp::_::RawSchema s_b88d09a9c5f39817; ...@@ -83,7 +83,7 @@ extern const ::capnp::_::RawSchema s_b88d09a9c5f39817;
extern const ::capnp::_::RawSchema s_89f389b6fd4082c1; extern const ::capnp::_::RawSchema s_89f389b6fd4082c1;
extern const ::capnp::_::RawSchema s_b47f4979672cb59d; extern const ::capnp::_::RawSchema s_b47f4979672cb59d;
extern const ::capnp::_::RawSchema s_95b29059097fca83; extern const ::capnp::_::RawSchema s_95b29059097fca83;
extern const ::capnp::_::RawSchema s_e34f40bff3af6b96; extern const ::capnp::_::RawSchema s_9d263a3630b7ebee;
} // namespace schemas } // namespace schemas
namespace _ { // private namespace _ { // private
...@@ -106,8 +106,8 @@ CAPNP_DECLARE_STRUCT( ...@@ -106,8 +106,8 @@ CAPNP_DECLARE_STRUCT(
::capnp::rpc::twoparty::JoinKeyPart, 95b29059097fca83, ::capnp::rpc::twoparty::JoinKeyPart, 95b29059097fca83,
1, 0, EIGHT_BYTES); 1, 0, EIGHT_BYTES);
CAPNP_DECLARE_STRUCT( CAPNP_DECLARE_STRUCT(
::capnp::rpc::twoparty::JoinAnswer, e34f40bff3af6b96, ::capnp::rpc::twoparty::JoinResult, 9d263a3630b7ebee,
1, 0, EIGHT_BYTES); 1, 1, INLINE_COMPOSITE);
} // namespace _ (private) } // namespace _ (private)
} // namespace capnp } // namespace capnp
...@@ -478,9 +478,9 @@ private: ...@@ -478,9 +478,9 @@ private:
friend struct ::capnp::ToDynamic_; friend struct ::capnp::ToDynamic_;
}; };
class JoinAnswer::Reader { class JoinResult::Reader {
public: public:
typedef JoinAnswer Reads; typedef JoinResult Reads;
Reader() = default; Reader() = default;
inline explicit Reader(::capnp::_::StructReader base): _reader(base) {} inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
...@@ -493,6 +493,9 @@ public: ...@@ -493,6 +493,9 @@ public:
inline bool getSucceeded() const; inline bool getSucceeded() const;
inline bool hasCap() const;
inline ::capnp::ObjectPointer::Reader getCap() const;
private: private:
::capnp::_::StructReader _reader; ::capnp::_::StructReader _reader;
template <typename T, ::capnp::Kind k> template <typename T, ::capnp::Kind k>
...@@ -503,16 +506,16 @@ private: ...@@ -503,16 +506,16 @@ private:
friend struct ::capnp::List; friend struct ::capnp::List;
friend class ::capnp::MessageBuilder; friend class ::capnp::MessageBuilder;
friend class ::capnp::Orphanage; friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(JoinAnswer::Reader reader); friend ::kj::StringTree KJ_STRINGIFY(JoinResult::Reader reader);
}; };
inline ::kj::StringTree KJ_STRINGIFY(JoinAnswer::Reader reader) { inline ::kj::StringTree KJ_STRINGIFY(JoinResult::Reader reader) {
return ::capnp::_::structString<JoinAnswer>(reader._reader); return ::capnp::_::structString<JoinResult>(reader._reader);
} }
class JoinAnswer::Builder { class JoinResult::Builder {
public: public:
typedef JoinAnswer Builds; typedef JoinResult Builds;
Builder() = delete; // Deleted to discourage incorrect usage. Builder() = delete; // Deleted to discourage incorrect usage.
// You can explicitly initialize to nullptr instead. // You can explicitly initialize to nullptr instead.
...@@ -529,21 +532,25 @@ public: ...@@ -529,21 +532,25 @@ public:
inline bool getSucceeded(); inline bool getSucceeded();
inline void setSucceeded(bool value); inline void setSucceeded(bool value);
inline bool hasCap();
inline ::capnp::ObjectPointer::Builder getCap();
inline ::capnp::ObjectPointer::Builder initCap();
private: private:
::capnp::_::StructBuilder _builder; ::capnp::_::StructBuilder _builder;
template <typename T, ::capnp::Kind k> template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_; friend struct ::capnp::ToDynamic_;
friend class ::capnp::Orphanage; friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(JoinAnswer::Builder builder); friend ::kj::StringTree KJ_STRINGIFY(JoinResult::Builder builder);
}; };
inline ::kj::StringTree KJ_STRINGIFY(JoinAnswer::Builder builder) { inline ::kj::StringTree KJ_STRINGIFY(JoinResult::Builder builder) {
return ::capnp::_::structString<JoinAnswer>(builder._builder.asReader()); return ::capnp::_::structString<JoinResult>(builder._builder.asReader());
} }
class JoinAnswer::Pipeline { class JoinResult::Pipeline {
public: public:
typedef JoinAnswer Pipelines; typedef JoinResult Pipelines;
inline Pipeline(decltype(nullptr)): _typeless(nullptr) {} inline Pipeline(decltype(nullptr)): _typeless(nullptr) {}
inline explicit Pipeline(::capnp::ObjectPointer::Pipeline&& typeless) inline explicit Pipeline(::capnp::ObjectPointer::Pipeline&& typeless)
...@@ -627,34 +634,55 @@ inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) { ...@@ -627,34 +634,55 @@ inline void JoinKeyPart::Builder::setPartNum( ::uint16_t value) {
3 * ::capnp::ELEMENTS, value); 3 * ::capnp::ELEMENTS, value);
} }
inline ::uint32_t JoinAnswer::Reader::getJoinId() const { inline ::uint32_t JoinResult::Reader::getJoinId() const {
return _reader.getDataField< ::uint32_t>( return _reader.getDataField< ::uint32_t>(
0 * ::capnp::ELEMENTS); 0 * ::capnp::ELEMENTS);
} }
inline ::uint32_t JoinAnswer::Builder::getJoinId() { inline ::uint32_t JoinResult::Builder::getJoinId() {
return _builder.getDataField< ::uint32_t>( return _builder.getDataField< ::uint32_t>(
0 * ::capnp::ELEMENTS); 0 * ::capnp::ELEMENTS);
} }
inline void JoinAnswer::Builder::setJoinId( ::uint32_t value) { inline void JoinResult::Builder::setJoinId( ::uint32_t value) {
_builder.setDataField< ::uint32_t>( _builder.setDataField< ::uint32_t>(
0 * ::capnp::ELEMENTS, value); 0 * ::capnp::ELEMENTS, value);
} }
inline bool JoinAnswer::Reader::getSucceeded() const { inline bool JoinResult::Reader::getSucceeded() const {
return _reader.getDataField<bool>( return _reader.getDataField<bool>(
32 * ::capnp::ELEMENTS); 32 * ::capnp::ELEMENTS);
} }
inline bool JoinAnswer::Builder::getSucceeded() { inline bool JoinResult::Builder::getSucceeded() {
return _builder.getDataField<bool>( return _builder.getDataField<bool>(
32 * ::capnp::ELEMENTS); 32 * ::capnp::ELEMENTS);
} }
inline void JoinAnswer::Builder::setSucceeded(bool value) { inline void JoinResult::Builder::setSucceeded(bool value) {
_builder.setDataField<bool>( _builder.setDataField<bool>(
32 * ::capnp::ELEMENTS, value); 32 * ::capnp::ELEMENTS, value);
} }
inline bool JoinResult::Reader::hasCap() const {
return !_reader.getPointerField(0 * ::capnp::POINTERS).isNull();
}
inline bool JoinResult::Builder::hasCap() {
return !_builder.getPointerField(0 * ::capnp::POINTERS).isNull();
}
inline ::capnp::ObjectPointer::Reader JoinResult::Reader::getCap() const {
return ::capnp::ObjectPointer::Reader(
_reader.getPointerField(0 * ::capnp::POINTERS));
}
inline ::capnp::ObjectPointer::Builder JoinResult::Builder::getCap() {
return ::capnp::ObjectPointer::Builder(
_builder.getPointerField(0 * ::capnp::POINTERS));
}
inline ::capnp::ObjectPointer::Builder JoinResult::Builder::initCap() {
auto result = ::capnp::ObjectPointer::Builder(
_builder.getPointerField(0 * ::capnp::POINTERS));
result.clear();
return result;
}
} // namespace } // namespace
} // namespace } // namespace
} // namespace } // namespace
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
namespace capnp { namespace capnp {
typedef VatNetwork<rpc::twoparty::SturdyRefHostId, rpc::twoparty::ProvisionId, typedef VatNetwork<rpc::twoparty::SturdyRefHostId, rpc::twoparty::ProvisionId,
rpc::twoparty::RecipientId, rpc::twoparty::ThirdPartyCapId, rpc::twoparty::JoinAnswer> rpc::twoparty::RecipientId, rpc::twoparty::ThirdPartyCapId, rpc::twoparty::JoinResult>
TwoPartyVatNetworkBase; TwoPartyVatNetworkBase;
class TwoPartyVatNetwork: public TwoPartyVatNetworkBase, class TwoPartyVatNetwork: public TwoPartyVatNetworkBase,
......
...@@ -1043,7 +1043,7 @@ private: ...@@ -1043,7 +1043,7 @@ private:
injector(kj::heap<CapInjectorImpl>(connectionState)), injector(kj::heap<CapInjectorImpl>(connectionState)),
context(*injector), context(*injector),
callBuilder(message->getBody().getAs<rpc::Message>().initCall()), callBuilder(message->getBody().getAs<rpc::Message>().initCall()),
paramsBuilder(context.imbue(callBuilder.getRequest())) {} paramsBuilder(context.imbue(callBuilder.getParams())) {}
inline ObjectPointer::Builder getRoot() { inline ObjectPointer::Builder getRoot() {
return paramsBuilder; return paramsBuilder;
...@@ -1407,7 +1407,7 @@ private: ...@@ -1407,7 +1407,7 @@ private:
requestCapExtractor.retainedListSizeHint(request == nullptr)); requestCapExtractor.retainedListSizeHint(request == nullptr));
returnMessage = message->getBody().initAs<rpc::Message>().initReturn(); returnMessage = message->getBody().initAs<rpc::Message>().initReturn();
auto response = kj::heap<RpcServerResponse>( auto response = kj::heap<RpcServerResponse>(
connectionState, kj::mv(message), returnMessage.getAnswer()); connectionState, kj::mv(message), returnMessage.getResults());
auto results = response->getResults(); auto results = response->getResults();
this->response = kj::mv(response); this->response = kj::mv(response);
return results; return results;
...@@ -1690,7 +1690,7 @@ private: ...@@ -1690,7 +1690,7 @@ private:
QuestionId questionId = call.getQuestionId(); QuestionId questionId = call.getQuestionId();
auto context = kj::refcounted<RpcCallContext>( auto context = kj::refcounted<RpcCallContext>(
*this, questionId, kj::mv(message), call.getRequest()); *this, questionId, kj::mv(message), call.getParams());
auto promiseAndPipeline = capability->call( auto promiseAndPipeline = capability->call(
call.getInterfaceId(), call.getMethodId(), context->addRef()); call.getInterfaceId(), call.getMethodId(), context->addRef());
...@@ -1754,9 +1754,9 @@ private: ...@@ -1754,9 +1754,9 @@ private:
} }
switch (ret.which()) { switch (ret.which()) {
case rpc::Return::ANSWER: case rpc::Return::RESULTS:
question->fulfiller->fulfill( question->fulfiller->fulfill(
kj::refcounted<RpcResponse>(*this, kj::mv(message), ret.getAnswer())); kj::refcounted<RpcResponse>(*this, kj::mv(message), ret.getResults()));
break; break;
case rpc::Return::EXCEPTION: case rpc::Return::EXCEPTION:
...@@ -1853,9 +1853,12 @@ private: ...@@ -1853,9 +1853,12 @@ private:
KJ_IF_MAYBE(exception, kj::runCatchingExceptions([&]() { KJ_IF_MAYBE(exception, kj::runCatchingExceptions([&]() {
KJ_IF_MAYBE(r, restorer) { KJ_IF_MAYBE(r, restorer) {
Capability::Client cap = r->baseRestore(restore.getObjectId()); Capability::Client cap = r->baseRestore(restore.getObjectId());
auto answer = context.imbue(ret.initAnswer()); auto results = context.imbue(ret.initResults());
answer.setAs<Capability>(cap); results.setAs<Capability>(cap);
capHook = answer.asReader().getPipelinedCap(nullptr);
// Hack to extract the ClientHook, because Capability::Client doesn't provide direct
// access. Maybe it should?
capHook = results.asReader().getPipelinedCap(nullptr);
} else { } else {
KJ_FAIL_REQUIRE("This vat cannot restore this SturdyRef.") { break; } KJ_FAIL_REQUIRE("This vat cannot restore this SturdyRef.") { break; }
} }
......
This diff is collapsed.
...@@ -275,7 +275,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = { ...@@ -275,7 +275,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = {
4, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113, 0, 0, 0, 66, 0, 0, 0, 113, 0, 0, 0, 58, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108, 0, 0, 0, 2, 0, 1, 0, 108, 0, 0, 0, 2, 0, 1, 0,
116, 0, 0, 0, 2, 0, 1, 0, 116, 0, 0, 0, 2, 0, 1, 0,
...@@ -304,7 +304,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = { ...@@ -304,7 +304,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = {
7, 0, 0, 0, 0, 0, 0, 0, 7, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114, 101, 113, 117, 101, 115, 116, 0, 112, 97, 114, 97, 109, 115, 0, 0,
18, 0, 0, 0, 0, 0, 0, 0, 18, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -315,7 +315,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = { ...@@ -315,7 +315,7 @@ static const ::capnp::_::AlignedData<83> b_836a53ce789d4cd4 = {
static const ::capnp::_::RawSchema* const d_836a53ce789d4cd4[] = { static const ::capnp::_::RawSchema* const d_836a53ce789d4cd4[] = {
&s_cb72865a863459a7, &s_cb72865a863459a7,
}; };
static const uint16_t m_836a53ce789d4cd4[] = {2, 3, 0, 4, 1}; static const uint16_t m_836a53ce789d4cd4[] = {2, 3, 4, 0, 1};
static const uint16_t i_836a53ce789d4cd4[] = {0, 1, 2, 3, 4}; static const uint16_t i_836a53ce789d4cd4[] = {0, 1, 2, 3, 4};
const ::capnp::_::RawSchema s_836a53ce789d4cd4 = { const ::capnp::_::RawSchema s_836a53ce789d4cd4 = {
0x836a53ce789d4cd4, b_836a53ce789d4cd4.words, 83, d_836a53ce789d4cd4, m_836a53ce789d4cd4, 0x836a53ce789d4cd4, b_836a53ce789d4cd4.words, 83, d_836a53ce789d4cd4, m_836a53ce789d4cd4,
...@@ -413,7 +413,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = { ...@@ -413,7 +413,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = {
2, 0, 255, 255, 1, 0, 0, 0, 2, 0, 255, 255, 1, 0, 0, 0,
0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
173, 0, 0, 0, 58, 0, 0, 0, 173, 0, 0, 0, 66, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
168, 0, 0, 0, 2, 0, 1, 0, 168, 0, 0, 0, 2, 0, 1, 0,
176, 0, 0, 0, 2, 0, 1, 0, 176, 0, 0, 0, 2, 0, 1, 0,
...@@ -457,7 +457,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = { ...@@ -457,7 +457,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = {
14, 0, 0, 0, 0, 0, 0, 0, 14, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97, 110, 115, 119, 101, 114, 0, 0, 114, 101, 115, 117, 108, 116, 115, 0,
18, 0, 0, 0, 0, 0, 0, 0, 18, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -493,7 +493,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = { ...@@ -493,7 +493,7 @@ static const ::capnp::_::AlignedData<109> b_9e19b28d3db3573a = {
static const ::capnp::_::RawSchema* const d_9e19b28d3db3573a[] = { static const ::capnp::_::RawSchema* const d_9e19b28d3db3573a[] = {
&s_d625b7063acf691a, &s_d625b7063acf691a,
}; };
static const uint16_t m_9e19b28d3db3573a[] = {2, 4, 3, 0, 1, 5}; static const uint16_t m_9e19b28d3db3573a[] = {4, 3, 0, 2, 1, 5};
static const uint16_t i_9e19b28d3db3573a[] = {2, 3, 4, 5, 0, 1}; static const uint16_t i_9e19b28d3db3573a[] = {2, 3, 4, 5, 0, 1};
const ::capnp::_::RawSchema s_9e19b28d3db3573a = { const ::capnp::_::RawSchema s_9e19b28d3db3573a = {
0x9e19b28d3db3573a, b_9e19b28d3db3573a.words, 109, d_9e19b28d3db3573a, m_9e19b28d3db3573a, 0x9e19b28d3db3573a, b_9e19b28d3db3573a.words, 109, d_9e19b28d3db3573a, m_9e19b28d3db3573a,
......
...@@ -65,7 +65,7 @@ struct Return { ...@@ -65,7 +65,7 @@ struct Return {
class Builder; class Builder;
class Pipeline; class Pipeline;
enum Which: uint16_t { enum Which: uint16_t {
ANSWER, RESULTS,
EXCEPTION, EXCEPTION,
CANCELED, CANCELED,
UNSUPPORTED_PIPELINE_OP, UNSUPPORTED_PIPELINE_OP,
...@@ -593,8 +593,8 @@ public: ...@@ -593,8 +593,8 @@ public:
inline ::uint16_t getMethodId() const; inline ::uint16_t getMethodId() const;
inline bool hasRequest() const; inline bool hasParams() const;
inline ::capnp::ObjectPointer::Reader getRequest() const; inline ::capnp::ObjectPointer::Reader getParams() const;
private: private:
::capnp::_::StructReader _reader; ::capnp::_::StructReader _reader;
...@@ -638,9 +638,9 @@ public: ...@@ -638,9 +638,9 @@ public:
inline ::uint16_t getMethodId(); inline ::uint16_t getMethodId();
inline void setMethodId( ::uint16_t value); inline void setMethodId( ::uint16_t value);
inline bool hasRequest(); inline bool hasParams();
inline ::capnp::ObjectPointer::Builder getRequest(); inline ::capnp::ObjectPointer::Builder getParams();
inline ::capnp::ObjectPointer::Builder initRequest(); inline ::capnp::ObjectPointer::Builder initParams();
private: private:
::capnp::_::StructBuilder _builder; ::capnp::_::StructBuilder _builder;
...@@ -774,9 +774,9 @@ public: ...@@ -774,9 +774,9 @@ public:
inline bool hasRetainedCaps() const; inline bool hasRetainedCaps() const;
inline ::capnp::List< ::uint32_t>::Reader getRetainedCaps() const; inline ::capnp::List< ::uint32_t>::Reader getRetainedCaps() const;
inline bool isAnswer() const; inline bool isResults() const;
inline bool hasAnswer() const; inline bool hasResults() const;
inline ::capnp::ObjectPointer::Reader getAnswer() const; inline ::capnp::ObjectPointer::Reader getResults() const;
inline bool isException() const; inline bool isException() const;
inline bool hasException() const; inline bool hasException() const;
...@@ -830,10 +830,10 @@ public: ...@@ -830,10 +830,10 @@ public:
inline void adoptRetainedCaps(::capnp::Orphan< ::capnp::List< ::uint32_t>>&& value); inline void adoptRetainedCaps(::capnp::Orphan< ::capnp::List< ::uint32_t>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::uint32_t>> disownRetainedCaps(); inline ::capnp::Orphan< ::capnp::List< ::uint32_t>> disownRetainedCaps();
inline bool isAnswer(); inline bool isResults();
inline bool hasAnswer(); inline bool hasResults();
inline ::capnp::ObjectPointer::Builder getAnswer(); inline ::capnp::ObjectPointer::Builder getResults();
inline ::capnp::ObjectPointer::Builder initAnswer(); inline ::capnp::ObjectPointer::Builder initResults();
inline bool isException(); inline bool isException();
inline bool hasException(); inline bool hasException();
...@@ -3070,21 +3070,21 @@ inline void Call::Builder::setMethodId( ::uint16_t value) { ...@@ -3070,21 +3070,21 @@ inline void Call::Builder::setMethodId( ::uint16_t value) {
5 * ::capnp::ELEMENTS, value); 5 * ::capnp::ELEMENTS, value);
} }
inline bool Call::Reader::hasRequest() const { inline bool Call::Reader::hasParams() const {
return !_reader.getPointerField(1 * ::capnp::POINTERS).isNull(); return !_reader.getPointerField(1 * ::capnp::POINTERS).isNull();
} }
inline bool Call::Builder::hasRequest() { inline bool Call::Builder::hasParams() {
return !_builder.getPointerField(1 * ::capnp::POINTERS).isNull(); return !_builder.getPointerField(1 * ::capnp::POINTERS).isNull();
} }
inline ::capnp::ObjectPointer::Reader Call::Reader::getRequest() const { inline ::capnp::ObjectPointer::Reader Call::Reader::getParams() const {
return ::capnp::ObjectPointer::Reader( return ::capnp::ObjectPointer::Reader(
_reader.getPointerField(1 * ::capnp::POINTERS)); _reader.getPointerField(1 * ::capnp::POINTERS));
} }
inline ::capnp::ObjectPointer::Builder Call::Builder::getRequest() { inline ::capnp::ObjectPointer::Builder Call::Builder::getParams() {
return ::capnp::ObjectPointer::Builder( return ::capnp::ObjectPointer::Builder(
_builder.getPointerField(1 * ::capnp::POINTERS)); _builder.getPointerField(1 * ::capnp::POINTERS));
} }
inline ::capnp::ObjectPointer::Builder Call::Builder::initRequest() { inline ::capnp::ObjectPointer::Builder Call::Builder::initParams() {
auto result = ::capnp::ObjectPointer::Builder( auto result = ::capnp::ObjectPointer::Builder(
_builder.getPointerField(1 * ::capnp::POINTERS)); _builder.getPointerField(1 * ::capnp::POINTERS));
result.clear(); result.clear();
...@@ -3233,35 +3233,35 @@ inline ::capnp::Orphan< ::capnp::List< ::uint32_t>> Return::Builder::disownRetai ...@@ -3233,35 +3233,35 @@ inline ::capnp::Orphan< ::capnp::List< ::uint32_t>> Return::Builder::disownRetai
_builder.getPointerField(0 * ::capnp::POINTERS)); _builder.getPointerField(0 * ::capnp::POINTERS));
} }
inline bool Return::Reader::isAnswer() const { inline bool Return::Reader::isResults() const {
return which() == Return::ANSWER; return which() == Return::RESULTS;
} }
inline bool Return::Builder::isAnswer() { inline bool Return::Builder::isResults() {
return which() == Return::ANSWER; return which() == Return::RESULTS;
} }
inline bool Return::Reader::hasAnswer() const { inline bool Return::Reader::hasResults() const {
if (which() != Return::ANSWER) return false; if (which() != Return::RESULTS) return false;
return !_reader.getPointerField(1 * ::capnp::POINTERS).isNull(); return !_reader.getPointerField(1 * ::capnp::POINTERS).isNull();
} }
inline bool Return::Builder::hasAnswer() { inline bool Return::Builder::hasResults() {
if (which() != Return::ANSWER) return false; if (which() != Return::RESULTS) return false;
return !_builder.getPointerField(1 * ::capnp::POINTERS).isNull(); return !_builder.getPointerField(1 * ::capnp::POINTERS).isNull();
} }
inline ::capnp::ObjectPointer::Reader Return::Reader::getAnswer() const { inline ::capnp::ObjectPointer::Reader Return::Reader::getResults() const {
KJ_IREQUIRE(which() == Return::ANSWER, KJ_IREQUIRE(which() == Return::RESULTS,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::ObjectPointer::Reader( return ::capnp::ObjectPointer::Reader(
_reader.getPointerField(1 * ::capnp::POINTERS)); _reader.getPointerField(1 * ::capnp::POINTERS));
} }
inline ::capnp::ObjectPointer::Builder Return::Builder::getAnswer() { inline ::capnp::ObjectPointer::Builder Return::Builder::getResults() {
KJ_IREQUIRE(which() == Return::ANSWER, KJ_IREQUIRE(which() == Return::RESULTS,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::ObjectPointer::Builder( return ::capnp::ObjectPointer::Builder(
_builder.getPointerField(1 * ::capnp::POINTERS)); _builder.getPointerField(1 * ::capnp::POINTERS));
} }
inline ::capnp::ObjectPointer::Builder Return::Builder::initAnswer() { inline ::capnp::ObjectPointer::Builder Return::Builder::initResults() {
_builder.setDataField<Return::Which>( _builder.setDataField<Return::Which>(
2 * ::capnp::ELEMENTS, Return::ANSWER); 2 * ::capnp::ELEMENTS, Return::RESULTS);
auto result = ::capnp::ObjectPointer::Builder( auto result = ::capnp::ObjectPointer::Builder(
_builder.getPointerField(1 * ::capnp::POINTERS)); _builder.getPointerField(1 * ::capnp::POINTERS));
result.clear(); result.clear();
......
...@@ -124,7 +124,7 @@ public: ...@@ -124,7 +124,7 @@ public:
}; };
template <typename SturdyRefHostId, typename ProvisionId, typename RecipientId, template <typename SturdyRefHostId, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
class VatNetwork: public _::VatNetworkBase { class VatNetwork: public _::VatNetworkBase {
public: public:
class Connection; class Connection;
...@@ -251,10 +251,10 @@ template <typename SturdyRefHostId> ...@@ -251,10 +251,10 @@ template <typename SturdyRefHostId>
class RpcSystem: public _::RpcSystemBase { class RpcSystem: public _::RpcSystemBase {
public: public:
template <typename ProvisionId, typename RecipientId, template <typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer, typename ThirdPartyCapId, typename JoinResult,
typename LocalSturdyRefObjectId> typename LocalSturdyRefObjectId>
RpcSystem( RpcSystem(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&> restorer, kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&> restorer,
const kj::EventLoop& eventLoop); const kj::EventLoop& eventLoop);
RpcSystem(RpcSystem&& other) = default; RpcSystem(RpcSystem&& other) = default;
...@@ -265,9 +265,9 @@ public: ...@@ -265,9 +265,9 @@ public:
}; };
template <typename SturdyRefHostId, typename LocalSturdyRefObjectId, template <typename SturdyRefHostId, typename LocalSturdyRefObjectId,
typename ProvisionId, typename RecipientId, typename ThirdPartyCapId, typename JoinAnswer> typename ProvisionId, typename RecipientId, typename ThirdPartyCapId, typename JoinResult>
RpcSystem<SturdyRefHostId> makeRpcServer( RpcSystem<SturdyRefHostId> makeRpcServer(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
SturdyRefRestorer<LocalSturdyRefObjectId>& restorer, SturdyRefRestorer<LocalSturdyRefObjectId>& restorer,
const kj::EventLoop& eventLoop = kj::EventLoop::current()); const kj::EventLoop& eventLoop = kj::EventLoop::current());
// Make an RPC server. Typical usage (e.g. in a main() function): // Make an RPC server. Typical usage (e.g. in a main() function):
...@@ -279,9 +279,9 @@ RpcSystem<SturdyRefHostId> makeRpcServer( ...@@ -279,9 +279,9 @@ RpcSystem<SturdyRefHostId> makeRpcServer(
// eventLoop.wait(...); // (e.g. wait on a promise that never returns) // eventLoop.wait(...); // (e.g. wait on a promise that never returns)
template <typename SturdyRefHostId, typename ProvisionId, template <typename SturdyRefHostId, typename ProvisionId,
typename RecipientId, typename ThirdPartyCapId, typename JoinAnswer> typename RecipientId, typename ThirdPartyCapId, typename JoinResult>
RpcSystem<SturdyRefHostId> makeRpcClient( RpcSystem<SturdyRefHostId> makeRpcClient(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
const kj::EventLoop& eventLoop = kj::EventLoop::current()); const kj::EventLoop& eventLoop = kj::EventLoop::current());
// Make an RPC client. Typical usage (e.g. in a main() function): // Make an RPC client. Typical usage (e.g. in a main() function):
// //
...@@ -300,8 +300,8 @@ RpcSystem<SturdyRefHostId> makeRpcClient( ...@@ -300,8 +300,8 @@ RpcSystem<SturdyRefHostId> makeRpcClient(
// ======================================================================================= // =======================================================================================
template <typename SturdyRef, typename ProvisionId, typename RecipientId, template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
void VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>:: void VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
Connection::baseIntroduceTo(VatNetworkBase::Connection& recipient, Connection::baseIntroduceTo(VatNetworkBase::Connection& recipient,
ObjectPointer::Builder sendToRecipient, ObjectPointer::Builder sendToRecipient,
ObjectPointer::Builder sendToTarget) { ObjectPointer::Builder sendToTarget) {
...@@ -310,26 +310,26 @@ void VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer ...@@ -310,26 +310,26 @@ void VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer
} }
template <typename SturdyRef, typename ProvisionId, typename RecipientId, template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
_::VatNetworkBase::ConnectionAndProvisionId _::VatNetworkBase::ConnectionAndProvisionId
VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>:: VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
Connection::baseConnectToIntroduced(ObjectPointer::Reader capId) { Connection::baseConnectToIntroduced(ObjectPointer::Reader capId) {
auto result = connectToIntroduced(capId.getAs<ThirdPartyCapId>()); auto result = connectToIntroduced(capId.getAs<ThirdPartyCapId>());
return { kj::mv(result.connection), kj::mv(result.firstMessage), kj::mv(result.provisionId) }; return { kj::mv(result.connection), kj::mv(result.firstMessage), kj::mv(result.provisionId) };
} }
template <typename SturdyRef, typename ProvisionId, typename RecipientId, template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
kj::Own<_::VatNetworkBase::Connection> kj::Own<_::VatNetworkBase::Connection>
VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>:: VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
Connection::baseAcceptIntroducedConnection(ObjectPointer::Reader recipientId) { Connection::baseAcceptIntroducedConnection(ObjectPointer::Reader recipientId) {
return acceptIntroducedConnection(recipientId.getAs<RecipientId>()); return acceptIntroducedConnection(recipientId.getAs<RecipientId>());
} }
template <typename SturdyRef, typename ProvisionId, typename RecipientId, template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
kj::Maybe<kj::Own<_::VatNetworkBase::Connection>> kj::Maybe<kj::Own<_::VatNetworkBase::Connection>>
VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>:: VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
baseConnectToRefHost(_::StructReader ref) { baseConnectToRefHost(_::StructReader ref) {
auto maybe = connectToRefHost(typename SturdyRef::Reader(ref)); auto maybe = connectToRefHost(typename SturdyRef::Reader(ref));
return maybe.map([](kj::Own<Connection>& conn) -> kj::Own<_::VatNetworkBase::Connection> { return maybe.map([](kj::Own<Connection>& conn) -> kj::Own<_::VatNetworkBase::Connection> {
...@@ -338,9 +338,9 @@ kj::Maybe<kj::Own<_::VatNetworkBase::Connection>> ...@@ -338,9 +338,9 @@ kj::Maybe<kj::Own<_::VatNetworkBase::Connection>>
} }
template <typename SturdyRef, typename ProvisionId, typename RecipientId, template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer> typename ThirdPartyCapId, typename JoinResult>
kj::Promise<kj::Own<_::VatNetworkBase::Connection>> kj::Promise<kj::Own<_::VatNetworkBase::Connection>>
VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>:: VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
baseAcceptConnectionAsRefHost() { baseAcceptConnectionAsRefHost() {
return acceptConnectionAsRefHost().thenInAnyThread( return acceptConnectionAsRefHost().thenInAnyThread(
[](kj::Own<Connection>&& connection) -> kj::Own<_::VatNetworkBase::Connection> { [](kj::Own<Connection>&& connection) -> kj::Own<_::VatNetworkBase::Connection> {
...@@ -355,10 +355,10 @@ Capability::Client SturdyRefRestorer<SturdyRef>::baseRestore(ObjectPointer::Read ...@@ -355,10 +355,10 @@ Capability::Client SturdyRefRestorer<SturdyRef>::baseRestore(ObjectPointer::Read
template <typename SturdyRefHostId> template <typename SturdyRefHostId>
template <typename ProvisionId, typename RecipientId, template <typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinAnswer, typename ThirdPartyCapId, typename JoinResult,
typename LocalSturdyRefObjectId> typename LocalSturdyRefObjectId>
RpcSystem<SturdyRefHostId>::RpcSystem( RpcSystem<SturdyRefHostId>::RpcSystem(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&> restorer, kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&> restorer,
const kj::EventLoop& eventLoop) const kj::EventLoop& eventLoop)
: _::RpcSystemBase(network, restorer, eventLoop) {} : _::RpcSystemBase(network, restorer, eventLoop) {}
...@@ -370,18 +370,18 @@ Capability::Client RpcSystem<SturdyRefHostId>::restore( ...@@ -370,18 +370,18 @@ Capability::Client RpcSystem<SturdyRefHostId>::restore(
} }
template <typename SturdyRefHostId, typename LocalSturdyRefObjectId, template <typename SturdyRefHostId, typename LocalSturdyRefObjectId,
typename ProvisionId, typename RecipientId, typename ThirdPartyCapId, typename JoinAnswer> typename ProvisionId, typename RecipientId, typename ThirdPartyCapId, typename JoinResult>
RpcSystem<SturdyRefHostId> makeRpcServer( RpcSystem<SturdyRefHostId> makeRpcServer(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
SturdyRefRestorer<LocalSturdyRefObjectId>& restorer, const kj::EventLoop& eventLoop) { SturdyRefRestorer<LocalSturdyRefObjectId>& restorer, const kj::EventLoop& eventLoop) {
return RpcSystem<SturdyRefHostId>(network, return RpcSystem<SturdyRefHostId>(network,
kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&>(restorer), eventLoop); kj::Maybe<SturdyRefRestorer<LocalSturdyRefObjectId>&>(restorer), eventLoop);
} }
template <typename SturdyRefHostId, typename ProvisionId, template <typename SturdyRefHostId, typename ProvisionId,
typename RecipientId, typename ThirdPartyCapId, typename JoinAnswer> typename RecipientId, typename ThirdPartyCapId, typename JoinResult>
RpcSystem<SturdyRefHostId> makeRpcClient( RpcSystem<SturdyRefHostId> makeRpcClient(
VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinAnswer>& network, VatNetwork<SturdyRefHostId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
const kj::EventLoop& eventLoop) { const kj::EventLoop& eventLoop) {
return RpcSystem<SturdyRefHostId>(network, return RpcSystem<SturdyRefHostId>(network,
kj::Maybe<SturdyRefRestorer<ObjectPointer>&>(nullptr), eventLoop); kj::Maybe<SturdyRefRestorer<ObjectPointer>&>(nullptr), eventLoop);
......
...@@ -626,4 +626,4 @@ struct TestSturdyRefObjectId { ...@@ -626,4 +626,4 @@ struct TestSturdyRefObjectId {
struct TestProvisionId {} struct TestProvisionId {}
struct TestRecipientId {} struct TestRecipientId {}
struct TestThirdPartyCapId {} struct TestThirdPartyCapId {}
struct TestJoinAnswer {} struct TestJoinResult {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment