Verified Commit 296b8d9c authored by Marc Vef's avatar Marc Vef
Browse files

Added Proxy decr_size support (truncate) for Client <-> Proxy

parent 9978d338
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ forward_stat_proxy(const std::string& path, std::string& attr);
int
forward_remove_proxy(const std::string& path);

int
forward_decr_size_proxy(const std::string& path, size_t length);

std::pair<int, off64_t>
forward_update_metadentry_size_proxy(const std::string& path, const size_t size,
                                     const off64_t offset,
+119 −2
Original line number Diff line number Diff line
@@ -3182,6 +3182,123 @@ struct remove_proxy {
    };
};

//==============================================================================
// definitions for decr_size_proxy
struct decr_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 = decr_size_proxy;
    using handle_type = hermes::rpc_handle<self_type>;
    using input_type = input;
    using output_type = output;
    using mercury_input_type = rpc_trunc_in_t;
    using mercury_output_type = rpc_err_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 = 27;

    // RPC internal Mercury identifier
    constexpr static const hg_id_t mercury_id = 0;

    // RPC name
    constexpr static const auto name = gkfs::rpc::tag::client_proxy_decr_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_trunc_in_t);

    // Mercury callback to serialize output arguments
    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 length)
            : m_path(path), m_length(length) {}

        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
        length() const {
            return m_length;
        }

        explicit input(const rpc_trunc_in_t& other)
            : m_path(other.path), m_length(other.length) {}

        explicit
        operator rpc_trunc_in_t() {
            return {m_path.c_str(), m_length};
        }

    private:
        std::string m_path;
        uint64_t m_length;
    };

    class output {

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

    public:
        output() : m_err() {}

        output(int32_t err) : m_err(err) {}

        output(output&& rhs) = default;

        output(const output& other) = default;

        output&
        operator=(output&& rhs) = default;

        output&
        operator=(const output& other) = default;

        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 update_metadentry_size
struct update_metadentry_size_proxy {
@@ -3202,7 +3319,7 @@ struct update_metadentry_size_proxy {
    // 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 = 27;
    constexpr static const uint64_t public_id = 28;

    // RPC internal Mercury identifier
    constexpr static const hg_id_t mercury_id = 0;
@@ -3341,7 +3458,7 @@ struct get_dirents_extended_proxy {
    // 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 = 28;
    constexpr static const uint64_t public_id = 29;

    // RPC internal Mercury identifier
    constexpr static const hg_id_t mercury_id = 0;
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ constexpr auto get_chunk_stat = "rpc_srv_chunk_stat";
constexpr auto client_proxy_create = "proxy_rpc_srv_create";
constexpr auto client_proxy_stat = "proxy_rpc_srv_stat";
constexpr auto client_proxy_remove = "proxy_rpc_srv_remove";
constexpr auto client_proxy_decr_size = "proxy_rpc_srv_decr_size";
constexpr auto client_proxy_update_size =
        "proxy_rpc_srv_update_metadentry_size";
constexpr auto client_proxy_write = "proxy_rpc_srv_write_data";
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ forward_stat(const std::string& path);
int
forward_remove(const std::string& path);

int
forward_decr_size(const std::string& path, size_t length);

std::pair<int, off64_t>
forward_update_metadentry_size(const std::string& path, const size_t size,
                               const off64_t offset, const bool append_flag);
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ DECLARE_MARGO_RPC_HANDLER(proxy_rpc_srv_stat)

DECLARE_MARGO_RPC_HANDLER(proxy_rpc_srv_remove)

DECLARE_MARGO_RPC_HANDLER(proxy_rpc_srv_decr_size)

DECLARE_MARGO_RPC_HANDLER(proxy_rpc_srv_update_metadentry_size)

DECLARE_MARGO_RPC_HANDLER(proxy_rpc_srv_read)
Loading