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

Added proxy read to client

parent 113834fe
Loading
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -774,13 +774,24 @@ gkfs_pread(std::shared_ptr<gkfs::filemap::OpenFile> file, char* buf,
    if constexpr(gkfs::config::io::zero_buffer_before_read) {
        memset(buf, 0, sizeof(char) * count);
    }
    if(CTX->use_proxy()) {
        auto ret =
                gkfs::rpc::forward_read_proxy(file->path(), buf, offset, count);
        if(ret < 0) {
            LOG(WARNING, "gkfs::rpc::forward_read_proxy() failed with ret {}",
                ret);
        }
        return ret; // return read size
    } else {
        auto ret = gkfs::rpc::forward_read(file->path(), buf, offset, count);
        if(ret.first < 0) {
        LOG(WARNING, "gkfs::rpc::forward_read() failed with ret {}", ret.first);
            LOG(WARNING, "gkfs::rpc::forward_read() failed with ret {}",
                ret.first);
        }
        // XXX check that we don't try to read past end of the file
        return ret.second; // return read size
    }
}

/**
 * gkfs wrapper for read() system calls