Verified Commit f26b11b5 authored by Marc Vef's avatar Marc Vef
Browse files

Finalizing proxy

parent d6724f78
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ forward_get_metadentry_size(const std::string& path, const int copy);
std::pair<int, std::shared_ptr<gkfs::filemap::OpenDir>>
forward_get_dirents(const std::string& path);

std::pair<int, std::vector<std::tuple<const std::string, bool, size_t, time_t>>>
std::pair<int, std::unique_ptr<std::vector<
                       std::tuple<const std::string, bool, size_t, time_t>>>>
forward_get_dirents_single(const std::string& path, int server);

#ifdef HAS_SYMLINKS
+2 −1
Original line number Diff line number Diff line
@@ -36,7 +36,8 @@ forward_update_metadentry_size_proxy(const std::string& path, const size_t size,
std::pair<int, off64_t>
forward_get_metadentry_size_proxy(const std::string& path);

std::pair<int, std::vector<std::tuple<const std::string, bool, size_t, time_t>>>
std::pair<int, std::unique_ptr<std::vector<
                       std::tuple<const std::string, bool, size_t, time_t>>>>
forward_get_dirents_single_proxy(const std::string& path, int server);

} // namespace gkfs::rpc
+6 −5
Original line number Diff line number Diff line
@@ -301,9 +301,9 @@ gkfs_create(const std::string& path, mode_t mode) {
            return -1;
    }

    // if(check_parent_dir(path)) {
    //     return -1;
    // }
    if(check_parent_dir(path)) {
        return -1;
    }
    int err = 0;
    if(gkfs::config::proxy::fwd_create && CTX->use_proxy()) {
        // no replication support for proxy
@@ -1662,7 +1662,8 @@ extern "C" int
gkfs_getsingleserverdir(const char* path, struct dirent_extended* dirp,
                        unsigned int count, int server) {

    pair<int, vector<tuple<const basic_string<char>, bool, size_t, time_t>>>
    pair<int, unique_ptr<vector<
                      tuple<const basic_string<char>, bool, size_t, time_t>>>>
            ret{};
    if(gkfs::config::proxy::fwd_get_dirents_single && CTX->use_proxy()) {
        ret = gkfs::rpc::forward_get_dirents_single_proxy(path, server);
@@ -1676,7 +1677,7 @@ gkfs_getsingleserverdir(const char* path, struct dirent_extended* dirp,
        return -1;
    }

    auto open_dir = ret.second;
    auto& open_dir = *ret.second;
    unsigned int pos = 0;
    unsigned int written = 0;
    struct dirent_extended* current_dirp = nullptr;
+7 −5
Original line number Diff line number Diff line
@@ -782,7 +782,7 @@ forward_get_dirents(const string& path) {
 * reusing the forward_get_dirents code. As we only need a server, we could
 * simplify the code removing the asynchronous part.
 */
pair<int, vector<tuple<const std::string, bool, size_t, time_t>>>
pair<int, unique_ptr<vector<tuple<const std::string, bool, size_t, time_t>>>>
forward_get_dirents_single(const string& path, int server) {

    if(gkfs::config::proxy::fwd_get_dirents_single && CTX->use_proxy()) {
@@ -805,7 +805,8 @@ forward_get_dirents_single(const string& path, int server) {

    // We use the full size per server...
    const std::size_t per_host_buff_size = gkfs::config::rpc::dirents_buff_size;
    vector<tuple<const std::string, bool, size_t, time_t>> output;
    auto output_ptr = make_unique<
            vector<tuple<const std::string, bool, size_t, time_t>>>();

    // expose local buffers for RMA from servers
    std::vector<hermes::exposed_memory> exposed_buffers;
@@ -819,7 +820,7 @@ forward_get_dirents_single(const string& path, int server) {
    } catch(const std::exception& ex) {
        LOG(ERROR, "{}() Failed to expose buffers for RMA. err '{}'", __func__,
            ex.what());
        return make_pair(EBUSY, output);
        return make_pair(EBUSY, std::move(output_ptr));
    }

    auto err = 0;
@@ -899,9 +900,10 @@ forward_get_dirents_single(const string& path, int server) {
        auto name = std::string(names_ptr);
        // number of characters in entry + \0 terminator
        names_ptr += name.size() + 1;
        output.emplace_back(std::forward_as_tuple(name, ftype, size, ctime));
        output_ptr->emplace_back(
                std::forward_as_tuple(name, ftype, size, ctime));
    }
    return make_pair(err, output);
    return make_pair(err, std::move(output_ptr));
}


+5 −4
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ forward_get_metadentry_size_proxy(const std::string& path) {
    }
}

pair<int, vector<tuple<const std::string, bool, size_t, time_t>>>
pair<int, unique_ptr<vector<tuple<const std::string, bool, size_t, time_t>>>>
forward_get_dirents_single_proxy(const string& path, int server) {

    LOG(DEBUG, "{}() enter for path '{}'", __func__, path)
@@ -221,7 +221,7 @@ forward_get_dirents_single_proxy(const string& path, int server) {
    } catch(const std::exception& ex) {
        LOG(ERROR, "{}() Failed to expose buffers for RMA. err '{}'", __func__,
            ex.what());
        return make_pair(EBUSY, output);
        return make_pair(EBUSY, std::move(output_ptr));
    }

    auto err = 0;
@@ -301,9 +301,10 @@ forward_get_dirents_single_proxy(const string& path, int server) {
        auto name = std::string(names_ptr);
        // number of characters in entry + \0 terminator
        names_ptr += name.size() + 1;
        output.emplace_back(std::forward_as_tuple(name, ftype, size, ctime));
        output_ptr->emplace_back(
                std::forward_as_tuple(name, ftype, size, ctime));
    }
    return make_pair(err, output);
    return make_pair(err, std::move(output_ptr));
}

} // namespace rpc