Commit 1052111c authored by Marc Vef's avatar Marc Vef
Browse files

Working local rpc read example

parent b3c30936
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16,8 +16,13 @@ bool RPCData::get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) {
    } else {
        ADAFS_DATA->spdlogger()->debug("not found in lrucache");
        // not found, manual lookup and add address mapping to LRU cache
#ifndef RPC_TEST
        auto hostname = "cci+tcp://" + ADAFS_DATA->hosts().at(hostid) + ":" +
                        ADAFS_DATA->rpc_port(); // convert hostid to hostname and port
#else
        auto hostname = "cci+tcp://134.93.182.11:" +
                        ADAFS_DATA->rpc_port(); // convert hostid to hostname and port
#endif
        ADAFS_DATA->spdlogger()->debug("generated hostid {}", hostname);
        margo_addr_lookup(RPC_DATA->client_mid(), hostname.c_str(), &svr_addr);
        if (svr_addr == HG_ADDR_NULL)
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include "../fuse_ops.hpp"
#include "../db/db_ops.hpp"
#include "../adafs_ops/mdata_ops.hpp"
#include "../rpc/client/c_data.hpp"

using namespace std;

@@ -37,6 +38,10 @@ using namespace std;
void adafs_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi) {
    \
    ADAFS_DATA->spdlogger()->debug("adafs_ll_read() enter: inode {} size {} offset {}", ino, size, off);
#ifdef RPC_TEST
    rpc_send_read(0, ino, size, off, nullptr);
#endif

    // TODO Check out how splicing works. This uses fuse_reply_data
    auto chnk_path = bfs::path(ADAFS_DATA->chunk_path());
    chnk_path /= fmt::FormatInt(ino).c_str();
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ int rpc_send_read(const size_t recipient, const fuse_ino_t inode, const size_t i
        ret = HG_Get_output(handle, &out);

        ADAFS_DATA->spdlogger()->debug("Got response mode {}", out.res);
        ADAFS_DATA->spdlogger()->debug("Filled buffer looks like this: {}", b_buf);
        ADAFS_DATA->spdlogger()->debug("Filled buffer looks like this: {}", (char*) b_buf);
        /* clean up resources consumed by this rpc */
        HG_Free_output(handle, &out);
    } else {
+2 −0
Original line number Diff line number Diff line
@@ -7,5 +7,7 @@

#include "../../main.hpp"

int rpc_send_read(const size_t recipient, const fuse_ino_t inode, const size_t in_size, const off_t in_offset,
                  char* tar_buf);

#endif //LFS_C_DATA_HPP
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ static hg_return_t rpc_srv_write_data(hg_handle_t handle) {

    // TODO pull data from client here

    auto mid = margo_hg_class_to_instance(hgi->hg_class);=
    auto mid = margo_hg_class_to_instance(hgi->hg_class);

    out.res = HG_TRUE;
    ADAFS_DATA->spdlogger()->debug("Sending output response {}", out.res);