Commit 19e785b1 authored by David Auer's avatar David Auer
Browse files

Decide on relocation

parent 310b469d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -78,15 +78,19 @@ rpc_srv_relocation_start(hg_handle_t handle) {
    auto const host_id = in.host_id;
    auto const host_size = in.host_size;
    gkfs::rpc::SimpleHashDistributor distributor(host_id, host_size);
    // TODO make use of distributor
    cout << fmt::format("Got host_id = {} and host_size = {}\n", host_id,
                        host_size);

    auto metadata_dump = GKFS_DATA->mdb()->get_all();

    for(auto metadatum : metadata_dump) {
        if(metadatum.first == "/") {
            continue;
        }
        bool move =
                distributor.locate_file_metadata(metadatum.first) != host_id;
        cout << "Checking " << metadatum.first << " Val: " << metadatum.second
             << "\n";
             << " Move: " << move << "\n";
    }

    out.err = 0; // TODO
+2 −2
Original line number Diff line number Diff line
@@ -86,9 +86,9 @@ test_d2d_rpc() {

    uint64_t host_counter = 0;
    for(auto host : hosts) {
        cout << fmt::format("Host {} bla {}\n", host.first, host.second);
        cout << fmt::format("Hostname: {} Address: {} ID: {}\n", host.first,
                            host.second, host_counter);
        hg_addr_t host_addr;
        // TODO
        rpc_relocation_start_in_t in{};
        rpc_err_out_t out{};
        in.host_id = host_counter; // TODO is this consistent with client?
+4 −4
Original line number Diff line number Diff line
@@ -31,14 +31,14 @@ SimpleHashDistributor::localhost() const {
host_t
SimpleHashDistributor::locate_data(const string& path,
                                   const chunkid_t& chnk_id) const {
    // return str_hash(path + ::to_string(chnk_id)) % hosts_size_;
    return hosts_size_ - 1;
    return str_hash(path + ::to_string(chnk_id)) % hosts_size_;
    // return hosts_size_ - 1;
}

host_t
SimpleHashDistributor::locate_file_metadata(const string& path) const {
    // return str_hash(path) % hosts_size_;
    return hosts_size_ - 1;
    return str_hash(path) % hosts_size_;
    // return hosts_size_ - 1;
}

::vector<host_t>