Loading include/config.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ namespace gkfs::config { // writes to dev null instead of chunk space, read is reading /dev/zero constexpr bool limbo_mode = false; constexpr auto hostfile_path = "./gkfs_hosts.txt"; constexpr auto forwarding_file_path = "./gkfs_forwarding.map"; Loading src/daemon/backend/data/chunk_storage.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <filesystem> #include <spdlog/spdlog.h> #include <config.hpp> extern "C" { #include <sys/statfs.h> Loading Loading @@ -155,10 +156,14 @@ ChunkStorage::write_chunk(const string& file_path, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); string chunk_path{}; if(gkfs::config::limbo_mode) { chunk_path = "/dev/null"s; } else { // may throw ChunkStorageException on failure init_chunk_space(file_path); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } FileHandle fh(open(chunk_path.c_str(), O_WRONLY | O_CREAT, 0640), chunk_path); Loading Loading @@ -212,7 +217,12 @@ ssize_t ChunkStorage::read_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id, char* buf, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); string chunk_path{}; if(gkfs::config::limbo_mode) { chunk_path = "/dev/zero"s; } else { chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } FileHandle fh(open(chunk_path.c_str(), O_RDONLY), chunk_path); if(!fh.valid()) { Loading src/daemon/handler/srv_metadata.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ rpc_srv_remove_data(hg_handle_t handle) { // Remove all chunks for that file try { if(!gkfs::config::limbo_mode) GKFS_DATA->storage()->destroy_chunk_space(in.path); out.err = 0; } catch(const gkfs::data::ChunkStorageException& e) { Loading Loading
include/config.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ namespace gkfs::config { // writes to dev null instead of chunk space, read is reading /dev/zero constexpr bool limbo_mode = false; constexpr auto hostfile_path = "./gkfs_hosts.txt"; constexpr auto forwarding_file_path = "./gkfs_forwarding.map"; Loading
src/daemon/backend/data/chunk_storage.cpp +15 −5 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <filesystem> #include <spdlog/spdlog.h> #include <config.hpp> extern "C" { #include <sys/statfs.h> Loading Loading @@ -155,10 +156,14 @@ ChunkStorage::write_chunk(const string& file_path, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); string chunk_path{}; if(gkfs::config::limbo_mode) { chunk_path = "/dev/null"s; } else { // may throw ChunkStorageException on failure init_chunk_space(file_path); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } FileHandle fh(open(chunk_path.c_str(), O_WRONLY | O_CREAT, 0640), chunk_path); Loading Loading @@ -212,7 +217,12 @@ ssize_t ChunkStorage::read_chunk(const string& file_path, gkfs::rpc::chnk_id_t chunk_id, char* buf, size_t size, off64_t offset) const { assert((offset + size) <= chunksize_); auto chunk_path = absolute(get_chunk_path(file_path, chunk_id)); string chunk_path{}; if(gkfs::config::limbo_mode) { chunk_path = "/dev/zero"s; } else { chunk_path = absolute(get_chunk_path(file_path, chunk_id)); } FileHandle fh(open(chunk_path.c_str(), O_RDONLY), chunk_path); if(!fh.valid()) { Loading
src/daemon/handler/srv_metadata.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -227,6 +227,7 @@ rpc_srv_remove_data(hg_handle_t handle) { // Remove all chunks for that file try { if(!gkfs::config::limbo_mode) GKFS_DATA->storage()->destroy_chunk_space(in.path); out.err = 0; } catch(const gkfs::data::ChunkStorageException& e) { Loading