Put some initial TODO's into the thrift handle

This commit is contained in:
Tyler Neely 2022-08-11 16:52:53 +00:00
parent 10c9f349a6
commit f98f4d6841

View File

@ -11,11 +11,14 @@
#pragma once
#include "io/message_conversion.hpp"
#include "io/transport.hpp"
namespace memgraph::io::thrift {
using memgraph::io::Address;
using memgraph::io::OpaqueMessage;
using memgraph::io::OpaquePromise;
class ThriftHandle {
// the responses to requests that are being waited on
@ -24,16 +27,27 @@ class ThriftHandle {
// messages that are sent to servers that may later receive them
std::map<Address, std::vector<OpaqueMessage>> can_receive_;
// TODO(tyler) thrift clients for each outbound address combination
std::map<Address, void> clients_;
public:
template <Message Request, Message Response>
void SubmitRequest(Address to_address, Address from_address, uint64_t request_id, Request &&request, Duration timeout,
ResponsePromise<Response> &&promise);
ResponsePromise<Response> &&promise) {
// TODO(tyler) simular to simulator transport, add the promise to the promises_ map
Send(to_address, from_address, request_id, request);
}
template <Message... Ms>
requires(sizeof...(Ms) > 0) RequestResult<Ms...> Receive(const Address &receiver, Duration timeout);
requires(sizeof...(Ms) > 0) RequestResult<Ms...> Receive(const Address &receiver, Duration timeout) {
// TODO(tyler) block for the specified duration on the Inbox's receipt of a message of this type.
}
template <Message M>
void Send(Address to_address, Address from_address, uint64_t request_id, M message);
void Send(Address to_address, Address from_address, uint64_t request_id, M message) {
// TODO(tyler) call thrift client for address (or create one if it doesn't exist yet)
}
};
} // namespace memgraph::io::thrift