diff --git a/src/io/thrift/thrift_handle.hpp b/src/io/thrift/thrift_handle.hpp index 834d81070..ec6502c5d 100644 --- a/src/io/thrift/thrift_handle.hpp +++ b/src/io/thrift/thrift_handle.hpp @@ -19,21 +19,25 @@ namespace memgraph::io::thrift { using memgraph::io::Address; using memgraph::io::OpaqueMessage; using memgraph::io::OpaquePromise; +using RequestId = uint64_t; class ThriftHandle { + mutable std::mutex mu_{}; + mutable std::condition_variable cv_; + // the responses to requests that are being waited on - std::map promises_; + std::map promises_; // messages that are sent to servers that may later receive them - std::map> can_receive_; + std::vector can_receive_; // TODO(tyler) thrift clients for each outbound address combination std::map clients_; public: template - void SubmitRequest(Address to_address, Address from_address, uint64_t request_id, Request &&request, Duration timeout, - ResponsePromise &&promise) { + void SubmitRequest(Address to_address, Address from_address, RequestId request_id, Request &&request, + Duration timeout, ResponsePromise &&promise) { // TODO(tyler) simular to simulator transport, add the promise to the promises_ map Send(to_address, from_address, request_id, request); @@ -45,7 +49,7 @@ class ThriftHandle { } template - void Send(Address to_address, Address from_address, uint64_t request_id, M message) { + void Send(Address to_address, Address from_address, RequestId request_id, M message) { // TODO(tyler) call thrift client for address (or create one if it doesn't exist yet) } };