Commit 29bc1dc5 authored by Ramon Nou's avatar Ramon Nou
Browse files

solved inline issue

parent b0d22cf7
Loading
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -116,13 +116,30 @@ int
forward_create_write_inline(const std::string& path, mode_t mode,
                            const std::string& data, uint64_t count,
                            const int copy) {
    auto res = forward_create(path, mode, copy);
    if(res != 0) {
        return res;
    if(!CTX->distributor()) {
        LOG(ERROR, "{}() Distributor not initialized!", __func__);
        return ENOTCONN;
    }
    auto host_id = CTX->distributor()->locate_file_metadata(path, copy);
    auto endp = CTX->hosts().at(host_id);

    if(!CTX->rpc_engine()) {
        LOG(ERROR, "{}() RPC engine not initialized!", __func__);
        return ENOTCONN;
    }
    // path, void* buf, off64_t offset, size_t write_size, bool append_flag
    auto write_res = forward_write_inline(path, data.c_str(), 0, count, false);
    return write_res.first;

    gkfs::rpc::rpc_create_write_inline_in_t in;
    in.path = path;
    in.mode = mode;
    in.data = std::vector<char>(data.begin(), data.end());
    in.count = count;

    auto out =
            gkfs::rpc::forward_call<gkfs::rpc::rpc_create_write_inline_out_t>(
                    CTX->rpc_engine(), endp,
                    gkfs::rpc::tag::create_write_inline, in, __func__, path);

    return out.err;
}

int