Commit eae03397 authored by Kenton Varda's avatar Kenton Varda

Cleanup: Replace use of _::StructReader in RPC interfaces with AnyStruct::Reader.

parent b8431197
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
virtual kj::Promise<void> shutdown() = 0; virtual kj::Promise<void> shutdown() = 0;
virtual AnyStruct::Reader baseGetPeerVatId() = 0; virtual AnyStruct::Reader baseGetPeerVatId() = 0;
}; };
virtual kj::Maybe<kj::Own<Connection>> baseConnect(_::StructReader vatId) = 0; virtual kj::Maybe<kj::Own<Connection>> baseConnect(AnyStruct::Reader vatId) = 0;
virtual kj::Promise<kj::Own<Connection>> baseAccept() = 0; virtual kj::Promise<kj::Own<Connection>> baseAccept() = 0;
}; };
...@@ -92,10 +92,8 @@ private: ...@@ -92,10 +92,8 @@ private:
class Impl; class Impl;
kj::Own<Impl> impl; kj::Own<Impl> impl;
Capability::Client baseBootstrap(_::StructReader vatId); Capability::Client baseBootstrap(AnyStruct::Reader vatId);
Capability::Client baseRestore(_::StructReader vatId, AnyPointer::Reader objectId); Capability::Client baseRestore(AnyStruct::Reader vatId, AnyPointer::Reader objectId);
// TODO(someday): Maybe define a public API called `TypelessStruct` so we don't have to rely
// on `_::StructReader` here?
template <typename> template <typename>
friend class capnp::RpcSystem; friend class capnp::RpcSystem;
......
...@@ -2628,13 +2628,13 @@ public: ...@@ -2628,13 +2628,13 @@ public:
}); });
} }
Capability::Client bootstrap(_::StructReader vatId) { Capability::Client bootstrap(AnyStruct::Reader vatId) {
// For now we delegate to restore() since it's equivalent, but eventually we'll remove restore() // For now we delegate to restore() since it's equivalent, but eventually we'll remove restore()
// and implement bootstrap() directly. // and implement bootstrap() directly.
return restore(vatId, AnyPointer::Reader()); return restore(vatId, AnyPointer::Reader());
} }
Capability::Client restore(_::StructReader vatId, AnyPointer::Reader objectId) { Capability::Client restore(AnyStruct::Reader vatId, AnyPointer::Reader objectId) {
KJ_IF_MAYBE(connection, network.baseConnect(vatId)) { KJ_IF_MAYBE(connection, network.baseConnect(vatId)) {
auto& state = getConnectionState(kj::mv(*connection)); auto& state = getConnectionState(kj::mv(*connection));
return Capability::Client(state.restore(objectId)); return Capability::Client(state.restore(objectId));
...@@ -2726,12 +2726,12 @@ RpcSystemBase::RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& res ...@@ -2726,12 +2726,12 @@ RpcSystemBase::RpcSystemBase(VatNetworkBase& network, SturdyRefRestorerBase& res
RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) noexcept = default; RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) noexcept = default;
RpcSystemBase::~RpcSystemBase() noexcept(false) {} RpcSystemBase::~RpcSystemBase() noexcept(false) {}
Capability::Client RpcSystemBase::baseBootstrap(_::StructReader vatId) { Capability::Client RpcSystemBase::baseBootstrap(AnyStruct::Reader vatId) {
return impl->bootstrap(vatId); return impl->bootstrap(vatId);
} }
Capability::Client RpcSystemBase::baseRestore( Capability::Client RpcSystemBase::baseRestore(
_::StructReader hostId, AnyPointer::Reader objectId) { AnyStruct::Reader hostId, AnyPointer::Reader objectId) {
return impl->restore(hostId, objectId); return impl->restore(hostId, objectId);
} }
......
...@@ -353,7 +353,7 @@ public: ...@@ -353,7 +353,7 @@ public:
private: private:
kj::Maybe<kj::Own<_::VatNetworkBase::Connection>> kj::Maybe<kj::Own<_::VatNetworkBase::Connection>>
baseConnect(_::StructReader hostId) override final; baseConnect(AnyStruct::Reader hostId) override final;
kj::Promise<kj::Own<_::VatNetworkBase::Connection>> baseAccept() override final; kj::Promise<kj::Own<_::VatNetworkBase::Connection>> baseAccept() override final;
}; };
...@@ -372,8 +372,8 @@ template <typename SturdyRef, typename ProvisionId, typename RecipientId, ...@@ -372,8 +372,8 @@ template <typename SturdyRef, typename ProvisionId, typename RecipientId,
typename ThirdPartyCapId, typename JoinResult> typename ThirdPartyCapId, typename JoinResult>
kj::Maybe<kj::Own<_::VatNetworkBase::Connection>> kj::Maybe<kj::Own<_::VatNetworkBase::Connection>>
VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>:: VatNetwork<SturdyRef, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>::
baseConnect(_::StructReader ref) { baseConnect(AnyStruct::Reader ref) {
auto maybe = connect(typename SturdyRef::Reader(ref)); auto maybe = connect(ref.as<SturdyRef>());
return maybe.map([](kj::Own<Connection>& conn) -> kj::Own<_::VatNetworkBase::Connection> { return maybe.map([](kj::Own<Connection>& conn) -> kj::Own<_::VatNetworkBase::Connection> {
return kj::mv(conn); return kj::mv(conn);
}); });
......
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