Loading include/client/rpc/forward_metadata.hpp +28 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,34 @@ forward_mk_symlink(const std::string& path, const std::string& target_path); #endif /** * @brief Send an RPC request to write a small amount of data directly * to the metadata server (inline). * * @param path The file path. * @param buf Pointer to the data buffer. * @param offset The file offset. * @param write_size The number of bytes to write. * @return int Error code (0 on success). */ int forward_write_inline(const std::string& path, const void* buf, off64_t offset, size_t write_size); /** * @brief Send an RPC request to read a small amount of data directly * from the metadata server (inline). * * @param path The file path. * @param buf Pointer to the destination buffer. * @param offset The file offset. * @param read_size The number of bytes to read. * @return std::pair<int, ssize_t> Error code and bytes read. */ std::pair<int, ssize_t> forward_read_inline(const std::string& path, void* buf, off64_t offset, size_t read_size); } // namespace rpc } // namespace gkfs Loading include/client/rpc/rpc_types.hpp +142 −0 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,146 @@ struct chunk_stat { }; }; struct write_data_inline { class input; class output; using self_type = write_data_inline; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_write_inline_in_t; using mercury_output_type = rpc_err_out_t; constexpr static const uint64_t public_id = 60; // Unique ID constexpr static const hg_id_t mercury_id = 0; constexpr static const auto name = gkfs::rpc::tag::write_data_inline; constexpr static const auto requires_response = true; constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_write_inline_in_t); constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_err_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, uint64_t offset, const std::string& data, uint64_t count) : m_path(path), m_offset(offset), m_data(data), m_count(count) {} explicit input(const rpc_write_inline_in_t& other) : m_path(other.path), m_offset(other.offset), m_data(other.data), m_count(other.count) {} explicit operator rpc_write_inline_in_t() { return {m_path.c_str(), m_offset, m_data.c_str(), m_count}; } private: std::string m_path; uint64_t m_offset; std::string m_data; uint64_t m_count; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(0) {} explicit output(const rpc_err_out_t& out) : m_err(out.err) {} int32_t err() const { return m_err; } private: int32_t m_err; }; }; //============================================================================== // definitions for read_data_inline struct read_data_inline { class input; class output; using self_type = read_data_inline; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_read_inline_in_t; using mercury_output_type = rpc_read_inline_out_t; constexpr static const uint64_t public_id = 61; // Unique ID constexpr static const hg_id_t mercury_id = 0; constexpr static const auto name = gkfs::rpc::tag::read_data_inline; constexpr static const auto requires_response = true; constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_read_inline_in_t); constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_read_inline_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, uint64_t offset, uint64_t count) : m_path(path), m_offset(offset), m_count(count) {} explicit input(const rpc_read_inline_in_t& other) : m_path(other.path), m_offset(other.offset), m_count(other.count) { } explicit operator rpc_read_inline_in_t() { return {m_path.c_str(), m_offset, m_count}; } private: std::string m_path; uint64_t m_offset; uint64_t m_count; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(0), m_count(0) {} explicit output(const rpc_read_inline_out_t& out) : m_err(out.err), m_data(out.data ? out.data : ""), m_count(out.count) {} int32_t err() const { return m_err; } const std::string& data() const { return m_data; } uint64_t count() const { return m_count; } private: int32_t m_err; std::string m_data; uint64_t m_count; }; }; //============================================================================== // definitions for write_data struct write_data_proxy { Loading Loading @@ -4180,6 +4320,8 @@ struct expand_finalize { }; } // namespace malleable::rpc } // namespace gkfs Loading include/common/common_defs.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,10 @@ constexpr auto client_proxy_get_dirents_extended = constexpr auto proxy_daemon_write = "proxy_daemon_rpc_srv_write_data"; constexpr auto proxy_daemon_read = "proxy_daemon_rpc_srv_read_data"; // inline data operations constexpr auto write_data_inline = "rpc_srv_write_data_inline"; constexpr auto read_data_inline = "rpc_srv_read_data_inline"; } // namespace tag namespace protocol { Loading include/common/metadata.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ private: // renamed path #endif #endif std::string inline_data_; void init_time(); Loading Loading @@ -163,6 +163,11 @@ public: #endif // HAS_RENAME #endif // HAS_SYMLINKS std::string inline_data() const; void inline_data(const std::string& data); }; } // namespace gkfs::metadata Loading include/common/rpc/rpc_types.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,18 @@ MERCURY_GEN_PROC(rpc_expand_start_in_t, MERCURY_GEN_PROC(rpc_migrate_metadata_in_t, ((hg_const_string_t) (key))((hg_const_string_t) (value))) // Inline write operations MERCURY_GEN_PROC(rpc_write_inline_in_t, ((hg_const_string_t) (path))((hg_uint64_t) (offset))( (hg_const_string_t) (data))((hg_uint64_t) (count))) // Input: path, offset, read length MERCURY_GEN_PROC(rpc_read_inline_in_t, ((hg_const_string_t) (path))((hg_uint64_t) (offset))( (hg_uint64_t) (count))) // Output: err, data buffer, bytes read MERCURY_GEN_PROC( rpc_read_inline_out_t, ((hg_int32_t) (err))((hg_const_string_t) (data))((hg_uint64_t) (count))) #endif // LFS_RPC_TYPES_HPP Loading
include/client/rpc/forward_metadata.hpp +28 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,34 @@ forward_mk_symlink(const std::string& path, const std::string& target_path); #endif /** * @brief Send an RPC request to write a small amount of data directly * to the metadata server (inline). * * @param path The file path. * @param buf Pointer to the data buffer. * @param offset The file offset. * @param write_size The number of bytes to write. * @return int Error code (0 on success). */ int forward_write_inline(const std::string& path, const void* buf, off64_t offset, size_t write_size); /** * @brief Send an RPC request to read a small amount of data directly * from the metadata server (inline). * * @param path The file path. * @param buf Pointer to the destination buffer. * @param offset The file offset. * @param read_size The number of bytes to read. * @return std::pair<int, ssize_t> Error code and bytes read. */ std::pair<int, ssize_t> forward_read_inline(const std::string& path, void* buf, off64_t offset, size_t read_size); } // namespace rpc } // namespace gkfs Loading
include/client/rpc/rpc_types.hpp +142 −0 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,146 @@ struct chunk_stat { }; }; struct write_data_inline { class input; class output; using self_type = write_data_inline; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_write_inline_in_t; using mercury_output_type = rpc_err_out_t; constexpr static const uint64_t public_id = 60; // Unique ID constexpr static const hg_id_t mercury_id = 0; constexpr static const auto name = gkfs::rpc::tag::write_data_inline; constexpr static const auto requires_response = true; constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_write_inline_in_t); constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_err_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, uint64_t offset, const std::string& data, uint64_t count) : m_path(path), m_offset(offset), m_data(data), m_count(count) {} explicit input(const rpc_write_inline_in_t& other) : m_path(other.path), m_offset(other.offset), m_data(other.data), m_count(other.count) {} explicit operator rpc_write_inline_in_t() { return {m_path.c_str(), m_offset, m_data.c_str(), m_count}; } private: std::string m_path; uint64_t m_offset; std::string m_data; uint64_t m_count; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(0) {} explicit output(const rpc_err_out_t& out) : m_err(out.err) {} int32_t err() const { return m_err; } private: int32_t m_err; }; }; //============================================================================== // definitions for read_data_inline struct read_data_inline { class input; class output; using self_type = read_data_inline; using handle_type = hermes::rpc_handle<self_type>; using input_type = input; using output_type = output; using mercury_input_type = rpc_read_inline_in_t; using mercury_output_type = rpc_read_inline_out_t; constexpr static const uint64_t public_id = 61; // Unique ID constexpr static const hg_id_t mercury_id = 0; constexpr static const auto name = gkfs::rpc::tag::read_data_inline; constexpr static const auto requires_response = true; constexpr static const auto mercury_in_proc_cb = HG_GEN_PROC_NAME(rpc_read_inline_in_t); constexpr static const auto mercury_out_proc_cb = HG_GEN_PROC_NAME(rpc_read_inline_out_t); class input { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: input(const std::string& path, uint64_t offset, uint64_t count) : m_path(path), m_offset(offset), m_count(count) {} explicit input(const rpc_read_inline_in_t& other) : m_path(other.path), m_offset(other.offset), m_count(other.count) { } explicit operator rpc_read_inline_in_t() { return {m_path.c_str(), m_offset, m_count}; } private: std::string m_path; uint64_t m_offset; uint64_t m_count; }; class output { template <typename ExecutionContext> friend hg_return_t hermes::detail::post_to_mercury(ExecutionContext*); public: output() : m_err(0), m_count(0) {} explicit output(const rpc_read_inline_out_t& out) : m_err(out.err), m_data(out.data ? out.data : ""), m_count(out.count) {} int32_t err() const { return m_err; } const std::string& data() const { return m_data; } uint64_t count() const { return m_count; } private: int32_t m_err; std::string m_data; uint64_t m_count; }; }; //============================================================================== // definitions for write_data struct write_data_proxy { Loading Loading @@ -4180,6 +4320,8 @@ struct expand_finalize { }; } // namespace malleable::rpc } // namespace gkfs Loading
include/common/common_defs.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,10 @@ constexpr auto client_proxy_get_dirents_extended = constexpr auto proxy_daemon_write = "proxy_daemon_rpc_srv_write_data"; constexpr auto proxy_daemon_read = "proxy_daemon_rpc_srv_read_data"; // inline data operations constexpr auto write_data_inline = "rpc_srv_write_data_inline"; constexpr auto read_data_inline = "rpc_srv_read_data_inline"; } // namespace tag namespace protocol { Loading
include/common/metadata.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ private: // renamed path #endif #endif std::string inline_data_; void init_time(); Loading Loading @@ -163,6 +163,11 @@ public: #endif // HAS_RENAME #endif // HAS_SYMLINKS std::string inline_data() const; void inline_data(const std::string& data); }; } // namespace gkfs::metadata Loading
include/common/rpc/rpc_types.hpp +14 −0 Original line number Diff line number Diff line Loading @@ -190,4 +190,18 @@ MERCURY_GEN_PROC(rpc_expand_start_in_t, MERCURY_GEN_PROC(rpc_migrate_metadata_in_t, ((hg_const_string_t) (key))((hg_const_string_t) (value))) // Inline write operations MERCURY_GEN_PROC(rpc_write_inline_in_t, ((hg_const_string_t) (path))((hg_uint64_t) (offset))( (hg_const_string_t) (data))((hg_uint64_t) (count))) // Input: path, offset, read length MERCURY_GEN_PROC(rpc_read_inline_in_t, ((hg_const_string_t) (path))((hg_uint64_t) (offset))( (hg_uint64_t) (count))) // Output: err, data buffer, bytes read MERCURY_GEN_PROC( rpc_read_inline_out_t, ((hg_int32_t) (err))((hg_const_string_t) (data))((hg_uint64_t) (count))) #endif // LFS_RPC_TYPES_HPP