From 14dbb72f6c6043b442c5a74299fbe55b9f199ca6 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Thu, 18 Jul 2024 19:07:53 +0200 Subject: wip --- modules/remote-filesystem/c++/SConscript | 38 ++++++++++++++++++++ modules/remote-filesystem/c++/remote.hpp | 59 ++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 modules/remote-filesystem/c++/SConscript create mode 100644 modules/remote-filesystem/c++/remote.hpp (limited to 'modules/remote-filesystem/c++') diff --git a/modules/remote-filesystem/c++/SConscript b/modules/remote-filesystem/c++/SConscript new file mode 100644 index 0000000..2bf03be --- /dev/null +++ b/modules/remote-filesystem/c++/SConscript @@ -0,0 +1,38 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +remote-filesystem_env = env.Clone(); + +remote-filesystem_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +remote-filesystem_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += remote-filesystem_env.sources; +env.headers += remote-filesystem_env.headers; + +## Shared lib +objects_shared = [] +remote-filesystem_env.add_source_files(objects_shared, remote-filesystem_env.sources, shared=True); +env.library_shared = remote-filesystem_env.SharedLibrary('#build/forstio-remote-filesystem', [objects_shared]); + +## Static lib +objects_static = [] +remote-filesystem_env.add_source_files(objects_static, remote-filesystem_env.sources, shared=False); +env.library_static = remote-filesystem_env.StaticLibrary('#build/forstio-remote-filesystem', [objects_static]); + +# Set Alias +env.Alias('library_remote-filesystem', [env.library_shared, env.library_static]); + +env.targets += ['library_remote-filesystem']; + +# Install +env.Install('$prefix/lib/', [env.library_shared, env.library_static]); +env.Install('$prefix/include/forstio/remote/filesystem/', [remote-filesystem_env.headers]); 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 + +#include + +namespace saw { +namespace rmt { +struct FileSystem {}; +} + +template<> +class remote_address { +private: + std::filesystem::path path_; +public: + remote_address(const std::filesystem::path& path__): + path_{path__} + {} +}; + +template +class rpc_client { +private: + ptr> addr_; +public: + rpc_client(ptr> addr__): + addr_{addr__} + {} +}; + +template +class rpc_server { +private: + ptr> addr_; +public: + rpc_server(ptr> addr__): + addr_{addr__} + {} +}; + +template<> +class remote { +private: + SAW_FORBID_COPY(remote); + SAW_FORBID_MOVE(remote); + + +public: + error_or>> parse_address(const std::string_view& path_v){ + return heap>(path_v); + } + + template + rpc_server listen(const remote_address& addr, typename rpc_server::InterfaceT iface){ + return {addr, std::move(iface)}; + } +}; +} -- cgit v1.2.3