Loading ifs/include/daemon/classes/fs_data.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -2,12 +2,14 @@ #ifndef LFS_FS_DATA_H #define LFS_FS_DATA_H #include "daemon/classes/uids_manager.hpp" #include <daemon/adafs_daemon.hpp> /* Forward declarations */ class MetadataDB; class ChunkStorage; class Distributor; class UidsManager; #include <unordered_map> #include <map> Loading Loading @@ -46,6 +48,8 @@ private: std::shared_ptr<ChunkStorage> storage_; // Distributor std::shared_ptr<Distributor> distributor_; // FUIDs manager std::shared_ptr<UidsManager> fuids_manager_; // configurable metadata bool atime_state_; Loading Loading @@ -114,6 +118,10 @@ public: std::shared_ptr<Distributor> distributor() const; void fuids_manager(std::shared_ptr<UidsManager> fuids_manager); std::shared_ptr<UidsManager> fuids_manager() const; const std::string& hosts_raw() const; void hosts_raw(const std::string& hosts_raw); Loading ifs/include/daemon/classes/uids_manager.hpp 0 → 100644 +25 −0 Original line number Diff line number Diff line #ifndef FS_UIDS_MANAGER_HPP #define FS_UIDS_MANAGER_HPP #pragma once #include <cstdint> // uint64_t def #include <atomic> typedef uint64_t UID; class UidsManager { private: const UID slots_num_; // number of total slots const UID my_slot_; // slot number assigned to this manager const UID uids_max_; // number of uids available for this manager const UID uids_offset_; // mask that have the first slot_num_bits_ to 0 and the rest 1 std::atomic<UID> uids_count_; // number of UIDs generated till now public: UidsManager(const UID slots_num, const UID my_slot); UID generate_uid(); }; #endif //FS_UIDS_MANAGER_HPP ifs/include/global/global_defs.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #define IFS_GLOBAL_DEFS_HPP #include <type_traits> // underlying_type #include <cstdint> // fuid_t // These constexpr set the RPC's identity and which handler the receiver end should use namespace hg_tag { Loading @@ -24,6 +25,7 @@ namespace hg_tag { // typedefs typedef unsigned long rpc_chnk_id_t; typedef uint_fast64_t fuid_t; template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { Loading ifs/include/global/metadata.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -8,8 +8,12 @@ #include <string> typedef uint64_t fuid_t; // File Unique ID class Metadata { private: fuid_t fuid_; time_t atime_; // access time. gets updated on file access unless mounted with noatime time_t mtime_; // modify time. gets updated when file content is modified. time_t ctime_; // change time. gets updated when the file attributes are changed AND when file content is modified. Loading @@ -32,6 +36,8 @@ public: void update_ACM_time(bool a, bool c, bool m); //Getter and Setter fuid_t fuid() const; void fuid(fuid_t fuid); time_t atime() const; void atime(time_t atime_); time_t mtime() const; Loading ifs/include/global/rpc/rpc_types.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,12 @@ MERCURY_GEN_PROC(rpc_minimal_out_t, ((int32_t) (output))) // misc generic rpc types MERCURY_GEN_PROC(rpc_err_out_t, ((hg_int32_t) (err))) MERCURY_GEN_PROC(rpc_fuid_out_t, ((uint64_t) (fuid)) \ ((int32_t) (err)) \ ) // Metadentry MERCURY_GEN_PROC(rpc_mk_node_in_t, ((hg_const_string_t) (path))\ Loading Loading
ifs/include/daemon/classes/fs_data.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -2,12 +2,14 @@ #ifndef LFS_FS_DATA_H #define LFS_FS_DATA_H #include "daemon/classes/uids_manager.hpp" #include <daemon/adafs_daemon.hpp> /* Forward declarations */ class MetadataDB; class ChunkStorage; class Distributor; class UidsManager; #include <unordered_map> #include <map> Loading Loading @@ -46,6 +48,8 @@ private: std::shared_ptr<ChunkStorage> storage_; // Distributor std::shared_ptr<Distributor> distributor_; // FUIDs manager std::shared_ptr<UidsManager> fuids_manager_; // configurable metadata bool atime_state_; Loading Loading @@ -114,6 +118,10 @@ public: std::shared_ptr<Distributor> distributor() const; void fuids_manager(std::shared_ptr<UidsManager> fuids_manager); std::shared_ptr<UidsManager> fuids_manager() const; const std::string& hosts_raw() const; void hosts_raw(const std::string& hosts_raw); Loading
ifs/include/daemon/classes/uids_manager.hpp 0 → 100644 +25 −0 Original line number Diff line number Diff line #ifndef FS_UIDS_MANAGER_HPP #define FS_UIDS_MANAGER_HPP #pragma once #include <cstdint> // uint64_t def #include <atomic> typedef uint64_t UID; class UidsManager { private: const UID slots_num_; // number of total slots const UID my_slot_; // slot number assigned to this manager const UID uids_max_; // number of uids available for this manager const UID uids_offset_; // mask that have the first slot_num_bits_ to 0 and the rest 1 std::atomic<UID> uids_count_; // number of UIDs generated till now public: UidsManager(const UID slots_num, const UID my_slot); UID generate_uid(); }; #endif //FS_UIDS_MANAGER_HPP
ifs/include/global/global_defs.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #define IFS_GLOBAL_DEFS_HPP #include <type_traits> // underlying_type #include <cstdint> // fuid_t // These constexpr set the RPC's identity and which handler the receiver end should use namespace hg_tag { Loading @@ -24,6 +25,7 @@ namespace hg_tag { // typedefs typedef unsigned long rpc_chnk_id_t; typedef uint_fast64_t fuid_t; template<typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) { Loading
ifs/include/global/metadata.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -8,8 +8,12 @@ #include <string> typedef uint64_t fuid_t; // File Unique ID class Metadata { private: fuid_t fuid_; time_t atime_; // access time. gets updated on file access unless mounted with noatime time_t mtime_; // modify time. gets updated when file content is modified. time_t ctime_; // change time. gets updated when the file attributes are changed AND when file content is modified. Loading @@ -32,6 +36,8 @@ public: void update_ACM_time(bool a, bool c, bool m); //Getter and Setter fuid_t fuid() const; void fuid(fuid_t fuid); time_t atime() const; void atime(time_t atime_); time_t mtime() const; Loading
ifs/include/global/rpc/rpc_types.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,12 @@ MERCURY_GEN_PROC(rpc_minimal_out_t, ((int32_t) (output))) // misc generic rpc types MERCURY_GEN_PROC(rpc_err_out_t, ((hg_int32_t) (err))) MERCURY_GEN_PROC(rpc_fuid_out_t, ((uint64_t) (fuid)) \ ((int32_t) (err)) \ ) // Metadentry MERCURY_GEN_PROC(rpc_mk_node_in_t, ((hg_const_string_t) (path))\ Loading