Commit 2c13c30d authored by Marc Vef's avatar Marc Vef
Browse files

Added update metadentry size to proxy

parent e8b26928
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@ forward_stat_proxy(const std::string& path, std::string& attr);
int
forward_remove_proxy(const std::string& path);

std::pair<int, off64_t>
forward_update_metadentry_size_proxy(const std::string& path, const size_t size,
                                     const off64_t offset,
                                     const bool append_flag);

} // namespace gkfs::rpc

#endif // GEKKOFS_FORWARD_METADATA_PROXY_HPP
+138 −0
Original line number Diff line number Diff line
@@ -2904,6 +2904,144 @@ struct remove_proxy {
    };
};

//==============================================================================
// definitions for update_metadentry_size
struct update_metadentry_size_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 = update_metadentry_size_proxy;
    using handle_type = hermes::rpc_handle<self_type>;
    using input_type = input;
    using output_type = output;
    using mercury_input_type = rpc_update_metadentry_size_in_t;
    using mercury_output_type = rpc_update_metadentry_size_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 = 3725459456;

    // 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_update_size;

    // 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_update_metadentry_size_in_t);

    // Mercury callback to serialize output arguments
    constexpr static const auto mercury_out_proc_cb =
            HG_GEN_PROC_NAME(rpc_update_metadentry_size_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 size, int64_t offset,
              bool append)
            : m_path(path), m_size(size), m_offset(offset), m_append(append) {}

        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;
        }

        uint64_t
        size() const {
            return m_size;
        }

        int64_t
        offset() const {
            return m_offset;
        }

        bool
        append() const {
            return m_append;
        }

        explicit input(const rpc_update_metadentry_size_in_t& other)
            : m_path(other.path), m_size(other.size), m_offset(other.offset),
              m_append(other.append) {}

        explicit operator rpc_update_metadentry_size_in_t() {
            return {m_path.c_str(), m_size, m_offset, m_append};
        }

    private:
        std::string m_path;
        uint64_t m_size;
        int64_t m_offset;
        bool m_append;
    };

    class output {

        template <typename ExecutionContext>
        friend hg_return_t
        hermes::detail::post_to_mercury(ExecutionContext*);

    public:
        output() : m_err(), m_ret_size() {}

        output(int32_t err, int64_t ret_size)
            : m_err(err), m_ret_size(ret_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_update_metadentry_size_out_t& out) {
            m_err = out.err;
            m_ret_size = out.ret_size;
        }

        int32_t
        err() const {
            return m_err;
        }

        int64_t
        ret_size() const {
            return m_ret_size;
        }

    private:
        int32_t m_err;
        int64_t m_ret_size;
    };
};

} // namespace rpc
} // namespace gkfs

+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ constexpr auto pid_path = "/tmp/gkfs_proxy.pid";
constexpr auto fwd_create = true;
constexpr auto fwd_stat = true;
constexpr auto fwd_remove = true;
constexpr auto fwd_update_size = true;
constexpr auto fwd_io = true;
// Only use proxy for io if write/read size is higher than set value
constexpr auto fwd_io_count_threshold = 4000;
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ constexpr auto get_chunk_stat = "rpc_srv_chunk_stat";
constexpr auto proxy_create = "proxy_rpc_srv_create";
constexpr auto proxy_stat = "proxy_rpc_srv_stat";
constexpr auto proxy_remove = "proxy_rpc_srv_remove";
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";
} // namespace tag
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ struct margo_client_ids {
    hg_id_t rpc_stat_id;
    hg_id_t rpc_remove_id;
    hg_id_t rpc_remove_data_id;
    hg_id_t rpc_update_metadentry_size_id;
    hg_id_t rpc_write_id;
    hg_id_t rpc_read_id;
};
Loading