Commit 653e20e4 authored by Marc Vef's avatar Marc Vef
Browse files

Moving rpc_utils global code to daemon and put it into gkfs::rpc

parent 942cac61
Loading
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -11,9 +11,8 @@
  SPDX-License-Identifier: MIT
*/


#ifndef GEKKOFS_RPC_UTILS_HPP
#define GEKKOFS_RPC_UTILS_HPP
#ifndef GEKKOFS_DAEMON_RPC_UTIL_HPP
#define GEKKOFS_DAEMON_RPC_UTIL_HPP

extern "C" {
#include <mercury_types.h>
@@ -23,8 +22,11 @@ extern "C" {

#include <string>

namespace gkfs {
namespace rpc {

template<typename I, typename O>
inline hg_return_t rpc_cleanup(hg_handle_t* handle, I* input, O* output, hg_bulk_t* bulk_handle) {
inline hg_return_t cleanup(hg_handle_t* handle, I* input, O* output, hg_bulk_t* bulk_handle) {
    auto ret = HG_SUCCESS;
    if (bulk_handle) {
        ret = margo_bulk_free(*bulk_handle);
@@ -50,21 +52,19 @@ inline hg_return_t rpc_cleanup(hg_handle_t* handle, I* input, O* output, hg_bulk
}

template<typename I, typename O>
inline hg_return_t rpc_cleanup_respond(hg_handle_t* handle, I* input, O* output, hg_bulk_t* bulk_handle) {
inline hg_return_t cleanup_respond(hg_handle_t* handle, I* input, O* output, hg_bulk_t* bulk_handle) {
    auto ret = HG_SUCCESS;
    if (output && handle) {
        ret = margo_respond(*handle, output);
        if (ret != HG_SUCCESS)
            return ret;
    }
    return rpc_cleanup(handle, input, static_cast<O*>(nullptr), bulk_handle);
    return cleanup(handle, input, static_cast<O*>(nullptr), bulk_handle);

}

hg_bool_t bool_to_merc_bool(bool state);

std::string get_my_hostname(bool short_hostname = false);
} // namespace rpc
} // namespace gkfs

std::string get_host_by_name(const std::string& hostname);

#endif //GEKKOFS_RPC_UTILS_HPP
#endif //GEKKOFS_DAEMON_RPC_UTIL_HPP
+31 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  SPDX-License-Identifier: MIT
*/


#ifndef GEKKOFS_GLOBAL_RPC_UTILS_HPP
#define GEKKOFS_GLOBAL_RPC_UTILS_HPP

extern "C" {
#include <mercury_types.h>
#include <mercury_proc_string.h>
}

#include <string>

hg_bool_t bool_to_merc_bool(bool state);

std::string get_my_hostname(bool short_hostname = false);

std::string get_host_by_name(const std::string& hostname);

#endif //GEKKOFS_GLOBAL_RPC_UTILS_HPP
+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ set(PRELOAD_SRC
    preload_context.cpp
    preload_util.cpp
    ../global/path_util.cpp
    ../global/rpc/rpc_utils.cpp
    ../global/rpc/rpc_util.cpp
    rpc/rpc_types.cpp
    rpc/forward_data.cpp
    rpc/forward_management.cpp
@@ -46,7 +46,7 @@ set(PRELOAD_HEADERS
    ../../include/global/global_defs.hpp
    ../../include/global/path_util.hpp
    ../../include/global/rpc/rpc_types.hpp
    ../../include/global/rpc/rpc_utils.hpp
    ../../include/global/rpc/rpc_util.hpp
    )

add_library(gkfs_intercept SHARED ${PRELOAD_SRC} ${PRELOAD_HEADERS})
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <client/logging.hpp>

#include <global/rpc/distributor.hpp>
#include <global/rpc/rpc_utils.hpp>
#include <global/rpc/rpc_util.hpp>
#include <global/env_util.hpp>

#include <hermes.hpp>
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include <client/open_dir.hpp>
#include <client/rpc/rpc_types.hpp>

#include <global/rpc/rpc_utils.hpp>
#include <global/rpc/rpc_util.hpp>
#include <global/rpc/distributor.hpp>
#include <global/rpc/rpc_types.hpp>

Loading