Loading include/client/rpc/forward_metadata_proxy.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ #ifndef GEKKOFS_FORWARD_METADATA_PROXY_HPP #define GEKKOFS_FORWARD_METADATA_PROXY_HPP namespace gkfs::filemap { class OpenDir; } namespace gkfs::rpc { int Loading @@ -30,6 +34,9 @@ forward_update_metadentry_size_proxy(const std::string& path, const size_t size, const off64_t offset, const bool append_flag); std::pair<int, std::shared_ptr<gkfs::filemap::OpenDir>> forward_get_dirents_proxy(const std::string& path); std::pair<int, std::vector<std::tuple<const std::string, bool, size_t, time_t>>> forward_get_dirents_single_proxy(const std::string& path, int server); Loading include/client/rpc/rpc_types.hpp +124 −0 Original line number Diff line number Diff line Loading @@ -3172,6 +3172,130 @@ struct update_metadentry_size_proxy { }; }; //============================================================================== // definitions for get_dirents_proxy struct get_dirents_proxy { // forward declarations of public input/output types for this RPC class input; class output; // traits used so that the engine knows what to do with the RPC using self_type = get_dirents_proxy; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_get_dirents_in_t; using mercury_output_type = rpc_get_dirents_out_t; // RPC public identifier // (N.B: we reuse the same IDs assigned by Margo so that the daemon // understands Hermes RPCs) constexpr static const uint64_t public_id = 4121034752; // TODO // RPC internal Mercury identifier constexpr static const hg_id_t mercury_id = public_id; // RPC name constexpr static const auto name = gkfs::rpc::tag::proxy_get_dirents; // requires response? constexpr static const auto requires_response = true; // Mercury callback to serialize input arguments constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_get_dirents_in_t); // Mercury callback to serialize output arguments constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_get_dirents_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, const hermes::exposed_memory& buffers) : m_path(path), m_buffers(buffers) {} input(input&& rhs) = default; input(const input& other) = default; input& operator=(input&& rhs) = default; input& operator=(const input& other) = default; std::string path() const { return m_path; } hermes::exposed_memory buffers() const { return m_buffers; } explicit input(const rpc_get_dirents_in_t& other) : m_path(other.path), m_buffers(other.bulk_handle) {} explicit operator rpc_get_dirents_in_t() { return {m_path.c_str(), hg_bulk_t(m_buffers)}; } private: std::string m_path; hermes::exposed_memory m_buffers; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(), m_dirents_size() {} output(int32_t err, size_t dirents_size) : m_err(err), m_dirents_size(dirents_size) {} output(output&& rhs) = default; output(const output& other) = default; output& operator=(output&& rhs) = default; output& operator=(const output& other) = default; explicit output(const rpc_get_dirents_out_t& out) { m_err = out.err; m_dirents_size = out.dirents_size; } int32_t err() const { return m_err; } size_t dirents_size() const { return m_dirents_size; } private: int32_t m_err; size_t m_dirents_size; }; }; //============================================================================== // definitions for get_dirents_extended struct get_dirents_extended_proxy { Loading include/common/common_defs.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ constexpr auto proxy_update_size = "proxy_rpc_srv_update_metadentry_size"; constexpr auto proxy_write = "proxy_rpc_srv_write_data"; constexpr auto proxy_read = "proxy_rpc_srv_read_data"; constexpr auto proxy_chunk_stat = "proxy_rpc_srv_chunk_stat"; constexpr auto proxy_get_dirents = "proxy_rpc_srv_get_dirents"; constexpr auto proxy_get_dirents_extended = "proxy_rpc_srv_get_dirents_extended"; } // namespace tag Loading include/config.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ constexpr auto fwd_update_size = true; constexpr auto fwd_io = true; constexpr auto fwd_chunk_stat = true; constexpr auto fwd_get_dirents_single = true; constexpr auto fwd_get_dirents = true; // Only use proxy for io if write/read size is higher than set value constexpr auto fwd_io_count_threshold = 0; Loading src/client/gkfs_functions.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -945,7 +945,12 @@ gkfs_opendir(const std::string& path) { return -1; } auto ret = gkfs::rpc::forward_get_dirents(path); pair<int, shared_ptr<filemap::OpenDir>> ret{}; if(gkfs::config::proxy::fwd_get_dirents && CTX->use_proxy()) { ret = gkfs::rpc::forward_get_dirents_proxy(path); } else { ret = gkfs::rpc::forward_get_dirents(path); } auto err = ret.first; if(err) { errno = err; Loading Loading
include/client/rpc/forward_metadata_proxy.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ #ifndef GEKKOFS_FORWARD_METADATA_PROXY_HPP #define GEKKOFS_FORWARD_METADATA_PROXY_HPP namespace gkfs::filemap { class OpenDir; } namespace gkfs::rpc { int Loading @@ -30,6 +34,9 @@ forward_update_metadentry_size_proxy(const std::string& path, const size_t size, const off64_t offset, const bool append_flag); std::pair<int, std::shared_ptr<gkfs::filemap::OpenDir>> forward_get_dirents_proxy(const std::string& path); std::pair<int, std::vector<std::tuple<const std::string, bool, size_t, time_t>>> forward_get_dirents_single_proxy(const std::string& path, int server); Loading
include/client/rpc/rpc_types.hpp +124 −0 Original line number Diff line number Diff line Loading @@ -3172,6 +3172,130 @@ struct update_metadentry_size_proxy { }; }; //============================================================================== // definitions for get_dirents_proxy struct get_dirents_proxy { // forward declarations of public input/output types for this RPC class input; class output; // traits used so that the engine knows what to do with the RPC using self_type = get_dirents_proxy; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_get_dirents_in_t; using mercury_output_type = rpc_get_dirents_out_t; // RPC public identifier // (N.B: we reuse the same IDs assigned by Margo so that the daemon // understands Hermes RPCs) constexpr static const uint64_t public_id = 4121034752; // TODO // RPC internal Mercury identifier constexpr static const hg_id_t mercury_id = public_id; // RPC name constexpr static const auto name = gkfs::rpc::tag::proxy_get_dirents; // requires response? constexpr static const auto requires_response = true; // Mercury callback to serialize input arguments constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_get_dirents_in_t); // Mercury callback to serialize output arguments constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_get_dirents_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, const hermes::exposed_memory& buffers) : m_path(path), m_buffers(buffers) {} input(input&& rhs) = default; input(const input& other) = default; input& operator=(input&& rhs) = default; input& operator=(const input& other) = default; std::string path() const { return m_path; } hermes::exposed_memory buffers() const { return m_buffers; } explicit input(const rpc_get_dirents_in_t& other) : m_path(other.path), m_buffers(other.bulk_handle) {} explicit operator rpc_get_dirents_in_t() { return {m_path.c_str(), hg_bulk_t(m_buffers)}; } private: std::string m_path; hermes::exposed_memory m_buffers; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(), m_dirents_size() {} output(int32_t err, size_t dirents_size) : m_err(err), m_dirents_size(dirents_size) {} output(output&& rhs) = default; output(const output& other) = default; output& operator=(output&& rhs) = default; output& operator=(const output& other) = default; explicit output(const rpc_get_dirents_out_t& out) { m_err = out.err; m_dirents_size = out.dirents_size; } int32_t err() const { return m_err; } size_t dirents_size() const { return m_dirents_size; } private: int32_t m_err; size_t m_dirents_size; }; }; //============================================================================== // definitions for get_dirents_extended struct get_dirents_extended_proxy { Loading
include/common/common_defs.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ constexpr auto proxy_update_size = "proxy_rpc_srv_update_metadentry_size"; constexpr auto proxy_write = "proxy_rpc_srv_write_data"; constexpr auto proxy_read = "proxy_rpc_srv_read_data"; constexpr auto proxy_chunk_stat = "proxy_rpc_srv_chunk_stat"; constexpr auto proxy_get_dirents = "proxy_rpc_srv_get_dirents"; constexpr auto proxy_get_dirents_extended = "proxy_rpc_srv_get_dirents_extended"; } // namespace tag Loading
include/config.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ constexpr auto fwd_update_size = true; constexpr auto fwd_io = true; constexpr auto fwd_chunk_stat = true; constexpr auto fwd_get_dirents_single = true; constexpr auto fwd_get_dirents = true; // Only use proxy for io if write/read size is higher than set value constexpr auto fwd_io_count_threshold = 0; Loading
src/client/gkfs_functions.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -945,7 +945,12 @@ gkfs_opendir(const std::string& path) { return -1; } auto ret = gkfs::rpc::forward_get_dirents(path); pair<int, shared_ptr<filemap::OpenDir>> ret{}; if(gkfs::config::proxy::fwd_get_dirents && CTX->use_proxy()) { ret = gkfs::rpc::forward_get_dirents_proxy(path); } else { ret = gkfs::rpc::forward_get_dirents(path); } auto err = ret.first; if(err) { errno = err; Loading