Commit d122a3db authored by Kenton Varda's avatar Kenton Varda

Rename connect() -> restore().

parent 9e411b7f
...@@ -256,7 +256,7 @@ protected: ...@@ -256,7 +256,7 @@ protected:
hostId.setHost("server"); hostId.setHost("server");
ref.getObjectId().initAs<test::TestSturdyRefObjectId>().setTag(tag); ref.getObjectId().initAs<test::TestSturdyRefObjectId>().setTag(tag);
return rpcClient.connect(hostId, ref.getObjectId()); return rpcClient.restore(hostId, ref.getObjectId());
} }
RpcTest() RpcTest()
......
...@@ -76,7 +76,7 @@ Capability::Client getPersistentCap(RpcSystem<rpc::twoparty::SturdyRefHostId>& c ...@@ -76,7 +76,7 @@ Capability::Client getPersistentCap(RpcSystem<rpc::twoparty::SturdyRefHostId>& c
objectIdMessage.initRoot<test::TestSturdyRefObjectId>().setTag(tag); objectIdMessage.initRoot<test::TestSturdyRefObjectId>().setTag(tag);
// Connect to the remote capability. // Connect to the remote capability.
return client.connect(hostId, objectIdMessage.getRoot<ObjectPointer>()); return client.restore(hostId, objectIdMessage.getRoot<ObjectPointer>());
} }
TEST(TwoPartyNetwork, Basic) { TEST(TwoPartyNetwork, Basic) {
......
...@@ -1919,7 +1919,7 @@ public: ...@@ -1919,7 +1919,7 @@ public:
} }
} }
Capability::Client connect(_::StructReader hostId, ObjectPointer::Reader objectId) { Capability::Client restore(_::StructReader hostId, ObjectPointer::Reader objectId) {
KJ_IF_MAYBE(connection, network.baseConnectToRefHost(hostId)) { KJ_IF_MAYBE(connection, network.baseConnectToRefHost(hostId)) {
auto lock = connections.lockExclusive(); auto lock = connections.lockExclusive();
auto& state = getConnectionState(kj::mv(*connection), *lock); auto& state = getConnectionState(kj::mv(*connection), *lock);
...@@ -1985,9 +1985,9 @@ RpcSystemBase::RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestore ...@@ -1985,9 +1985,9 @@ RpcSystemBase::RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestore
RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) = default; RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) = default;
RpcSystemBase::~RpcSystemBase() noexcept(false) {} RpcSystemBase::~RpcSystemBase() noexcept(false) {}
Capability::Client RpcSystemBase::baseConnect( Capability::Client RpcSystemBase::baseRestore(
_::StructReader hostId, ObjectPointer::Reader objectId) { _::StructReader hostId, ObjectPointer::Reader objectId) {
return impl->connect(hostId, objectId); return impl->restore(hostId, objectId);
} }
} // namespace _ (private) } // namespace _ (private)
......
...@@ -89,7 +89,7 @@ private: ...@@ -89,7 +89,7 @@ private:
class Impl; class Impl;
kj::Own<Impl> impl; kj::Own<Impl> impl;
Capability::Client baseConnect(_::StructReader hostId, ObjectPointer::Reader objectId); Capability::Client baseRestore(_::StructReader hostId, ObjectPointer::Reader objectId);
// TODO(someday): Maybe define a public API called `TypelessStruct` so we don't have to rely // TODO(someday): Maybe define a public API called `TypelessStruct` so we don't have to rely
// on `_::StructReader` here? // on `_::StructReader` here?
...@@ -259,7 +259,7 @@ public: ...@@ -259,7 +259,7 @@ public:
const kj::EventLoop& eventLoop); const kj::EventLoop& eventLoop);
RpcSystem(RpcSystem&& other) = default; RpcSystem(RpcSystem&& other) = default;
Capability::Client connect(typename SturdyRefHostId::Reader hostId, Capability::Client restore(typename SturdyRefHostId::Reader hostId,
ObjectPointer::Reader objectId); ObjectPointer::Reader objectId);
// Restore the given SturdyRef from the network and return the capability representing it. // Restore the given SturdyRef from the network and return the capability representing it.
}; };
...@@ -289,7 +289,7 @@ RpcSystem<SturdyRefHostId> makeRpcClient( ...@@ -289,7 +289,7 @@ RpcSystem<SturdyRefHostId> makeRpcClient(
// MyNetwork network(eventLoop); // MyNetwork network(eventLoop);
// MyRestorer restorer; // MyRestorer restorer;
// auto client = makeRpcClient(network, restorer); // auto client = makeRpcClient(network, restorer);
// MyCapability::Client cap = client.connect(myRef).castAs<MyCapability>(); // MyCapability::Client cap = client.restore(hostId, objId).castAs<MyCapability>();
// auto response = eventLoop.wait(cap.fooRequest().send()); // auto response = eventLoop.wait(cap.fooRequest().send());
// handleMyResponse(response); // handleMyResponse(response);
...@@ -364,9 +364,9 @@ RpcSystem<SturdyRefHostId>::RpcSystem( ...@@ -364,9 +364,9 @@ RpcSystem<SturdyRefHostId>::RpcSystem(
: _::RpcSystemBase(network, restorer, eventLoop) {} : _::RpcSystemBase(network, restorer, eventLoop) {}
template <typename SturdyRefHostId> template <typename SturdyRefHostId>
Capability::Client RpcSystem<SturdyRefHostId>::connect( Capability::Client RpcSystem<SturdyRefHostId>::restore(
typename SturdyRefHostId::Reader hostId, ObjectPointer::Reader objectId) { typename SturdyRefHostId::Reader hostId, ObjectPointer::Reader objectId) {
return baseConnect(_::PointerHelpers<SturdyRefHostId>::getInternalReader(hostId), objectId); return baseRestore(_::PointerHelpers<SturdyRefHostId>::getInternalReader(hostId), objectId);
} }
template <typename SturdyRefHostId, typename LocalSturdyRefObjectId, template <typename SturdyRefHostId, typename LocalSturdyRefObjectId,
......
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