From b3042e2e1919d8a903cd2204d6b401ed4d97817a Mon Sep 17 00:00:00 2001 From: gvolfing <gabor.volfinger@memgraph.io> Date: Mon, 22 Aug 2022 12:53:50 +0200 Subject: [PATCH] Comment on the usecase of the ThriftHandle::Send() method --- src/io/thrift/thrift_handle.hpp | 55 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/io/thrift/thrift_handle.hpp b/src/io/thrift/thrift_handle.hpp index 5cbf4b15d..6db577019 100644 --- a/src/io/thrift/thrift_handle.hpp +++ b/src/io/thrift/thrift_handle.hpp @@ -169,38 +169,43 @@ class ThriftHandle { return std::move(m_opt).value(); } + // This method is used for communication for in-between different + // machines and processes, its exact functionality will be + // implemented later after the shape of the Thrift generated + // UberMessage is specified as this is not needed for M1. template <Message M> 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) + MG_ASSERT(false, "Communication in-between different machines and processes is not yet implemented!"); - cpp2::UberMessage uber_message; + // // TODO(tyler) call thrift client for address (or create one if it doesn't exist yet) + // cpp2::UberMessage uber_message; - uber_message.to_address_ref() = convertToUberAddress(to_address); - uber_message.from_address_ref() = convertToUberAddress(from_address); - uber_message.request_id_ref() = static_cast<int64_t>(request_id); - // uber_message.high_level_union() = message; + // uber_message.to_address_ref() = convertToUberAddress(to_address); + // uber_message.from_address_ref() = convertToUberAddress(from_address); + // uber_message.request_id_ref() = static_cast<int64_t>(request_id); + // uber_message.high_level_union_ref() = message; - // cpp2::UberMessage uber_message = { - // .to_address = convertToUberAddress(to_address), - // .from_address = convertToUberAddress(from_address), - // .request_id = static_cast<int64_t>(request_id), - // .high_level_union = message - // }; + // // cpp2::UberMessage uber_message = { + // // .to_address = convertToUberAddress(to_address), + // // .from_address = convertToUberAddress(from_address), + // // .request_id = static_cast<int64_t>(request_id), + // // .high_level_union = message + // // }; - if (clients_.contains(to_address)) { - auto &client = clients_[to_address]; - client->sync_ReceiveUberMessage(uber_message); - } else { - // maybe make this into a member var - const auto &other_ip = to_address.last_known_ip.to_string(); - const auto &other_port = to_address.last_known_port; - auto socket(folly::AsyncSocket::newSocket(&base_, other_ip, other_port)); - auto client_channel = HeaderClientChannel::newChannel(std::move(socket)); - // Create a client object - cpp2::UberServerAsyncClient client(std::move(client_channel)); + // if (clients_.contains(to_address)) { + // auto &client = clients_[to_address]; + // client->sync_ReceiveUberMessage(uber_message); + // } else { + // // maybe make this into a member var + // const auto &other_ip = to_address.last_known_ip.to_string(); + // const auto &other_port = to_address.last_known_port; + // auto socket(folly::AsyncSocket::newSocket(&base_, other_ip, other_port)); + // auto client_channel = HeaderClientChannel::newChannel(std::move(socket)); + // // Create a client object + // cpp2::UberServerAsyncClient client(std::move(client_channel)); - client.sync_ReceiveUberMessage(uber_message); - } + // client.sync_ReceiveUberMessage(uber_message); + // } } };