Loading include/client/cache.hpp +10 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ public: * @param value */ void insert(const std::string& parent_dir, std::string name, cache_entry value); insert(const std::string& parent_dir, const std::string& name, cache_entry value); /** * @brief Get an entry from the cache for a given directory Loading Loading @@ -167,6 +168,14 @@ public: std::pair<size_t, size_t> record(std::string path, size_t size); /** * @brief Get the cached size for a given path * @param path * @return [size_update counter, current cached size] */ std::pair<size_t, size_t> get(const std::string& path); /** * @brief reset entry from the cache * @param path Loading include/client/gkfs_functions.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #define GEKKOFS_GKFS_FUNCTIONS_HPP #include <client/open_file_map.hpp> #include <vector> #include <common/metadata.hpp> #include <client/intercept.hpp> Loading Loading @@ -184,6 +185,9 @@ int gkfs_rename(const std::string& old_path, const std::string& new_path); #endif // HAS_RENAME int gkfs_utimensat(const std::string& path, const struct timespec times[2]); // gkfs_mmap void* gkfs_mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset); Loading include/client/rpc/forward_metadata.hpp +40 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <string> #include <memory> #include <vector> #include <cstdint> /* Forward declaration */ namespace gkfs { namespace filemap { Loading @@ -63,7 +64,13 @@ int forward_create(const std::string& path, mode_t mode, const int copy); int forward_stat(const std::string& path, std::string& attr, const int copy); forward_create_write_inline(const std::string& path, mode_t mode, const std::string& data, uint64_t count, const int copy); int forward_stat(const std::string& path, std::string& attr, std::string& inline_data, int copy, bool include_inline = false); #ifdef HAS_RENAME int Loading @@ -86,7 +93,7 @@ forward_update_metadentry(const std::string& path, std::pair<int, off64_t> forward_update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag, const int num_copies); bool clear_inline_flag, const int num_copies); std::pair<int, off64_t> forward_get_metadentry_size(const std::string& path, const int copy); Loading @@ -96,7 +103,9 @@ forward_get_dirents(const std::string& path); 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); forward_get_dirents_single(const std::string& path, int server, const std::string& start_key = "", bool get_all = true); #ifdef HAS_SYMLINKS Loading @@ -105,6 +114,34 @@ forward_mk_symlink(const std::string& path, const std::string& target_path); #endif /** * @brief Send an RPC request to write a small amount of data directly * to the metadata server (inline). * * @param path The file path. * @param buf Pointer to the data buffer. * @param offset The file offset. * @param append_flag Whether to append to the file. * @return std::pair<int, off64_t> Error code and offset written. */ std::pair<int, off64_t> forward_write_inline(const std::string& path, const void* buf, off64_t offset, size_t write_size, bool append_flag); /** * @brief Send an RPC request to read a small amount of data directly * from the metadata server (inline). * * @param path The file path. * @param buf Pointer to the destination buffer. * @param offset The file offset. * @param read_size The number of bytes to read. * @return std::pair<int, ssize_t> Error code and bytes read. */ std::pair<int, ssize_t> forward_read_inline(const std::string& path, void* buf, off64_t offset, size_t read_size); } // namespace rpc } // namespace gkfs Loading include/client/rpc/forward_metadata_proxy.hpp +7 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ #ifndef GEKKOFS_FORWARD_METADATA_PROXY_HPP #define GEKKOFS_FORWARD_METADATA_PROXY_HPP #include <string> #include <vector> #include <memory> #include <tuple> #include <sys/types.h> namespace gkfs::rpc { int Loading @@ -48,7 +54,7 @@ forward_get_metadentry_size_proxy(const std::string& path); 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); forward_get_dirents_single_proxy_v2(const std::string& path, int server); } // namespace gkfs::rpc Loading include/common/metadata.hpp +13 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ namespace gkfs::metadata { constexpr const char MSP = '|'; constexpr mode_t LINK_MODE = ((S_IRWXU | S_IRWXG | S_IRWXO) | S_IFLNK); uint16_t Loading @@ -72,7 +74,7 @@ private: // renamed path #endif #endif std::string inline_data_; void init_time(); Loading @@ -85,6 +87,11 @@ public: Metadata(mode_t mode, const std::string& target_path); #ifdef HAS_RENAME Metadata(mode_t mode, const std::string& target_path, const std::string& rename_path); #endif #endif // Construct from a binary representation of the object Loading Loading @@ -163,6 +170,11 @@ public: #endif // HAS_RENAME #endif // HAS_SYMLINKS std::string inline_data() const; void inline_data(const std::string& data); }; } // namespace gkfs::metadata Loading Loading
include/client/cache.hpp +10 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,8 @@ public: * @param value */ void insert(const std::string& parent_dir, std::string name, cache_entry value); insert(const std::string& parent_dir, const std::string& name, cache_entry value); /** * @brief Get an entry from the cache for a given directory Loading Loading @@ -167,6 +168,14 @@ public: std::pair<size_t, size_t> record(std::string path, size_t size); /** * @brief Get the cached size for a given path * @param path * @return [size_update counter, current cached size] */ std::pair<size_t, size_t> get(const std::string& path); /** * @brief reset entry from the cache * @param path Loading
include/client/gkfs_functions.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #define GEKKOFS_GKFS_FUNCTIONS_HPP #include <client/open_file_map.hpp> #include <vector> #include <common/metadata.hpp> #include <client/intercept.hpp> Loading Loading @@ -184,6 +185,9 @@ int gkfs_rename(const std::string& old_path, const std::string& new_path); #endif // HAS_RENAME int gkfs_utimensat(const std::string& path, const struct timespec times[2]); // gkfs_mmap void* gkfs_mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset); Loading
include/client/rpc/forward_metadata.hpp +40 −3 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <string> #include <memory> #include <vector> #include <cstdint> /* Forward declaration */ namespace gkfs { namespace filemap { Loading @@ -63,7 +64,13 @@ int forward_create(const std::string& path, mode_t mode, const int copy); int forward_stat(const std::string& path, std::string& attr, const int copy); forward_create_write_inline(const std::string& path, mode_t mode, const std::string& data, uint64_t count, const int copy); int forward_stat(const std::string& path, std::string& attr, std::string& inline_data, int copy, bool include_inline = false); #ifdef HAS_RENAME int Loading @@ -86,7 +93,7 @@ forward_update_metadentry(const std::string& path, std::pair<int, off64_t> forward_update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag, const int num_copies); bool clear_inline_flag, const int num_copies); std::pair<int, off64_t> forward_get_metadentry_size(const std::string& path, const int copy); Loading @@ -96,7 +103,9 @@ forward_get_dirents(const std::string& path); 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); forward_get_dirents_single(const std::string& path, int server, const std::string& start_key = "", bool get_all = true); #ifdef HAS_SYMLINKS Loading @@ -105,6 +114,34 @@ forward_mk_symlink(const std::string& path, const std::string& target_path); #endif /** * @brief Send an RPC request to write a small amount of data directly * to the metadata server (inline). * * @param path The file path. * @param buf Pointer to the data buffer. * @param offset The file offset. * @param append_flag Whether to append to the file. * @return std::pair<int, off64_t> Error code and offset written. */ std::pair<int, off64_t> forward_write_inline(const std::string& path, const void* buf, off64_t offset, size_t write_size, bool append_flag); /** * @brief Send an RPC request to read a small amount of data directly * from the metadata server (inline). * * @param path The file path. * @param buf Pointer to the destination buffer. * @param offset The file offset. * @param read_size The number of bytes to read. * @return std::pair<int, ssize_t> Error code and bytes read. */ std::pair<int, ssize_t> forward_read_inline(const std::string& path, void* buf, off64_t offset, size_t read_size); } // namespace rpc } // namespace gkfs Loading
include/client/rpc/forward_metadata_proxy.hpp +7 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ #ifndef GEKKOFS_FORWARD_METADATA_PROXY_HPP #define GEKKOFS_FORWARD_METADATA_PROXY_HPP #include <string> #include <vector> #include <memory> #include <tuple> #include <sys/types.h> namespace gkfs::rpc { int Loading @@ -48,7 +54,7 @@ forward_get_metadentry_size_proxy(const std::string& path); 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); forward_get_dirents_single_proxy_v2(const std::string& path, int server); } // namespace gkfs::rpc Loading
include/common/metadata.hpp +13 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ namespace gkfs::metadata { constexpr const char MSP = '|'; constexpr mode_t LINK_MODE = ((S_IRWXU | S_IRWXG | S_IRWXO) | S_IFLNK); uint16_t Loading @@ -72,7 +74,7 @@ private: // renamed path #endif #endif std::string inline_data_; void init_time(); Loading @@ -85,6 +87,11 @@ public: Metadata(mode_t mode, const std::string& target_path); #ifdef HAS_RENAME Metadata(mode_t mode, const std::string& target_path, const std::string& rename_path); #endif #endif // Construct from a binary representation of the object Loading Loading @@ -163,6 +170,11 @@ public: #endif // HAS_RENAME #endif // HAS_SYMLINKS std::string inline_data() const; void inline_data(const std::string& data); }; } // namespace gkfs::metadata Loading