diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-18 19:07:53 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-07-18 19:07:53 +0200 |
commit | 14dbb72f6c6043b442c5a74299fbe55b9f199ca6 (patch) | |
tree | 09f1dbf37ab555c4be3a734af43ac860da027194 /modules/remote-filesystem/c++/remote.hpp | |
parent | f1223709e193c4513047293a1a42b55b9e8874b8 (diff) |
wip
Diffstat (limited to 'modules/remote-filesystem/c++/remote.hpp')
-rw-r--r-- | modules/remote-filesystem/c++/remote.hpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/modules/remote-filesystem/c++/remote.hpp b/modules/remote-filesystem/c++/remote.hpp new file mode 100644 index 0000000..42cdd03 --- /dev/null +++ b/modules/remote-filesystem/c++/remote.hpp @@ -0,0 +1,59 @@ +#pragma once + +#include <filesystem> + +#include <forstio/remote/remote.hpp> + +namespace saw { +namespace rmt { +struct FileSystem {}; +} + +template<> +class remote_address<rmt::FileSystem> { +private: + std::filesystem::path path_; +public: + remote_address(const std::filesystem::path& path__): + path_{path__} + {} +}; + +template<typename Iface, typename Encoding, typename Storage> +class rpc_client<Iface, Encoding, Storage, rmt::FileSystem> { +private: + ptr<remote_address<rmt::FileSystem>> addr_; +public: + rpc_client(ptr<remote_address<rmt::FileSystem>> addr__): + addr_{addr__} + {} +}; + +template<typename Iface, typename Encoding, typename Storage> +class rpc_server<Iface, Encoding, Storage, rmt::FileSystem> { +private: + ptr<remote_address<rmt::FileSystem>> addr_; +public: + rpc_server(ptr<remote_address<rmt::FileSystem>> addr__): + addr_{addr__} + {} +}; + +template<> +class remote<rmt::FileSystem> { +private: + SAW_FORBID_COPY(remote); + SAW_FORBID_MOVE(remote); + + +public: + error_or<own<remote_address<rmt::FileSystem>>> parse_address(const std::string_view& path_v){ + return heap<remote_address<rmt::FileSystem>>(path_v); + } + + template<typename Iface, typename Encoding, typename Storage> + rpc_server<Iface, Encoding, Storage, rmt::FileSystem> listen(const remote_address<rmt::FileSystem>& addr, typename rpc_server<Iface,Encoding,Storage,rmt::FileSystem>::InterfaceT iface){ + return {addr, std::move(iface)}; + } +}; +} |