From c64c76e273084cfd5b8628fb268e803957fc3025 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 23 Mar 2024 17:48:09 +0100 Subject: codec, io_codec: forst and rpc work --- modules/codec/c++/rpc.hpp | 94 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 15 deletions(-) (limited to 'modules/codec/c++/rpc.hpp') diff --git a/modules/codec/c++/rpc.hpp b/modules/codec/c++/rpc.hpp index 63ec014..9f59455 100644 --- a/modules/codec/c++/rpc.hpp +++ b/modules/codec/c++/rpc.hpp @@ -1,34 +1,98 @@ #pragma once namespace saw { + +/** + * + */ +template +class remote_data { +private: + id id_; +public: + remote_data(const id& id): + id_{id} + {} + + /** + * Wait until data arrives + */ + error_or> wait(wait_scope& wait); + + /** + * Asynchronously wait for a result + */ + conveyor> on_receive(); +}; + /** + * Client RPC reference structure */ template class rpc_client { - template - struct request { - private: - std::tuple...> ids_; - public: - error_or...>> wait(); - }; + /** + * request the data from the remote + */ + template + remote_data request_data(id data); - template - request request_data(id... data); + /** + * Determine type based on Name + */ + template + error_or< + id< + typename schema_member_type::type + > + > call(data_or_id inp); }; +/** + * Implementation of a remote server on the backend + */ template class rpc_server { +private: + interface iface_; +public: + rpc_server(interface iface): + iface_{std::move(iface)} + {} }; +/** + * Representation of a remote. + * Partially similar to a network address + */ template -class remote { - static_assert(always_false, "Type of remote not supported"); +class remote_address { + static_assert(always_false, "Type of remote not supported"); + + +}; + +/** + * Reference Backend structure + */ +template +class remote_context { + static_assert(always_false, "Type of backend not supported"); + + /** + * Resolves an address on the remote + */ + conveyor> resolve_address(); - template - rpc_client connect(); + /** + * Connect to a remote + */ + template + conveyor> connect(const remote_address& addr); - template - rpc_server listen(network& net); + /** + * Start listening + */ + template + rpc_server listen(); }; } -- cgit v1.2.3