Loading ifs/include/daemon/adafs_ops/metadentry.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ size_t get_metadentry_size(const std::string& path); int update_metadentry_size(const std::string& path, size_t io_size, off_t offset, bool append, size_t& read_size); int update_metadentry(const std::string& path, Metadata& md); void update_metadentry(const std::string& path, Metadata& md); int check_access_mask(const std::string& path, int mask); Loading ifs/include/daemon/backend/metadata/db.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ class MetadataDB { void put(const std::string& key, const std::string& val); void remove(const std::string& key); bool exists(const std::string& key); bool update(const std::string& old_key, const std::string& new_key, const std::string& val); void update(const std::string& old_key, const std::string& new_key, const std::string& val); bool update_size(const std::string& key, size_t size, off64_t offset, bool append); void iterate_all(); }; Loading ifs/src/daemon/adafs_ops/metadentry.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -97,8 +97,8 @@ int update_metadentry_size(const string& path, size_t io_size, off64_t offset, b return 0; } int update_metadentry(const string& path, Metadata& md) { return ADAFS_DATA->mdb()->update(path, md.path(), md.serialize()) ? 0 : -1; void update_metadentry(const string& path, Metadata& md) { ADAFS_DATA->mdb()->update(path, md.path(), md.serialize()); } /** Loading ifs/src/daemon/backend/metadata/db.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -78,11 +78,15 @@ bool MetadataDB::exists(const std::string& key) { * @param val * @return */ bool MetadataDB::update(const std::string& old_key, const std::string& new_key, const std::string& val) { void MetadataDB::update(const std::string& old_key, const std::string& new_key, const std::string& val) { //TODO use rdb::Put() method rdb::WriteBatch batch; batch.Delete(old_key); batch.Put(new_key, val); return db->Write(write_opts, &batch).ok(); auto s = db->Write(write_opts, &batch); if(!s.ok()){ MetadataDB::throw_rdb_status_excpt(s); } } bool MetadataDB::update_size(const std::string& key, size_t size, off64_t offset, bool append){ Loading ifs/src/daemon/handler/h_metadentry.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -185,7 +185,6 @@ static hg_return_t rpc_srv_update_metadentry(hg_handle_t handle) { // do update try { Metadata md = get_metadentry(in.path); out.err = 0; if (in.inode_no_flag == HG_TRUE) md.inode_no(in.inode_no); if (in.block_flag == HG_TRUE) Loading @@ -204,7 +203,8 @@ static hg_return_t rpc_srv_update_metadentry(hg_handle_t handle) { md.mtime(in.mtime); if (in.ctime_flag == HG_TRUE) md.ctime(in.ctime); out.err = update_metadentry(in.path, md); update_metadentry(in.path, md); out.err = 0; } catch (const std::exception& e){ //TODO handle NotFoundException ADAFS_DATA->spdlogger()->error("{}() Failed to update entry", __func__); Loading Loading
ifs/include/daemon/adafs_ops/metadentry.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ size_t get_metadentry_size(const std::string& path); int update_metadentry_size(const std::string& path, size_t io_size, off_t offset, bool append, size_t& read_size); int update_metadentry(const std::string& path, Metadata& md); void update_metadentry(const std::string& path, Metadata& md); int check_access_mask(const std::string& path, int mask); Loading
ifs/include/daemon/backend/metadata/db.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ class MetadataDB { void put(const std::string& key, const std::string& val); void remove(const std::string& key); bool exists(const std::string& key); bool update(const std::string& old_key, const std::string& new_key, const std::string& val); void update(const std::string& old_key, const std::string& new_key, const std::string& val); bool update_size(const std::string& key, size_t size, off64_t offset, bool append); void iterate_all(); }; Loading
ifs/src/daemon/adafs_ops/metadentry.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -97,8 +97,8 @@ int update_metadentry_size(const string& path, size_t io_size, off64_t offset, b return 0; } int update_metadentry(const string& path, Metadata& md) { return ADAFS_DATA->mdb()->update(path, md.path(), md.serialize()) ? 0 : -1; void update_metadentry(const string& path, Metadata& md) { ADAFS_DATA->mdb()->update(path, md.path(), md.serialize()); } /** Loading
ifs/src/daemon/backend/metadata/db.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -78,11 +78,15 @@ bool MetadataDB::exists(const std::string& key) { * @param val * @return */ bool MetadataDB::update(const std::string& old_key, const std::string& new_key, const std::string& val) { void MetadataDB::update(const std::string& old_key, const std::string& new_key, const std::string& val) { //TODO use rdb::Put() method rdb::WriteBatch batch; batch.Delete(old_key); batch.Put(new_key, val); return db->Write(write_opts, &batch).ok(); auto s = db->Write(write_opts, &batch); if(!s.ok()){ MetadataDB::throw_rdb_status_excpt(s); } } bool MetadataDB::update_size(const std::string& key, size_t size, off64_t offset, bool append){ Loading
ifs/src/daemon/handler/h_metadentry.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -185,7 +185,6 @@ static hg_return_t rpc_srv_update_metadentry(hg_handle_t handle) { // do update try { Metadata md = get_metadentry(in.path); out.err = 0; if (in.inode_no_flag == HG_TRUE) md.inode_no(in.inode_no); if (in.block_flag == HG_TRUE) Loading @@ -204,7 +203,8 @@ static hg_return_t rpc_srv_update_metadentry(hg_handle_t handle) { md.mtime(in.mtime); if (in.ctime_flag == HG_TRUE) md.ctime(in.ctime); out.err = update_metadentry(in.path, md); update_metadentry(in.path, md); out.err = 0; } catch (const std::exception& e){ //TODO handle NotFoundException ADAFS_DATA->spdlogger()->error("{}() Failed to update entry", __func__); Loading