Line data Source code
1 : /* 2 : Copyright 2018-2024, Barcelona Supercomputing Center (BSC), Spain 3 : Copyright 2015-2024, Johannes Gutenberg Universitaet Mainz, Germany 4 : 5 : This software was partially supported by the 6 : EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu). 7 : 8 : This software was partially supported by the 9 : ADA-FS project under the SPPEXA project funded by the DFG. 10 : 11 : This file is part of GekkoFS. 12 : 13 : GekkoFS is free software: you can redistribute it and/or modify 14 : it under the terms of the GNU General Public License as published by 15 : the Free Software Foundation, either version 3 of the License, or 16 : (at your option) any later version. 17 : 18 : GekkoFS is distributed in the hope that it will be useful, 19 : but WITHOUT ANY WARRANTY; without even the implied warranty of 20 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 : GNU General Public License for more details. 22 : 23 : You should have received a copy of the GNU General Public License 24 : along with GekkoFS. If not, see <https://www.gnu.org/licenses/>. 25 : 26 : SPDX-License-Identifier: GPL-3.0-or-later 27 : */ 28 : 29 : #include <daemon/backend/metadata/metadata_module.hpp> 30 : 31 : namespace gkfs::metadata { 32 : 33 : const std::shared_ptr<spdlog::logger>& 34 66 : MetadataModule::log() const { 35 66 : return log_; 36 : } 37 : 38 : void 39 33 : MetadataModule::log(const std::shared_ptr<spdlog::logger>& log) { 40 33 : MetadataModule::log_ = log; 41 33 : } 42 : 43 : const std::map<uint16_t, size_t>& 44 0 : MetadataModule::append_offset_reserve() const { 45 0 : return append_offset_reserve_; 46 : } 47 : 48 : void 49 15 : MetadataModule::append_offset_reserve_put(uint16_t merge_id, size_t offset) { 50 15 : std::lock_guard<std::mutex> lock(append_offset_reserve_mutex_); 51 15 : append_offset_reserve_[merge_id] = offset; 52 15 : } 53 : 54 : size_t 55 3 : MetadataModule::append_offset_reserve_get_and_erase(uint16_t merge_id) { 56 3 : std::lock_guard<std::mutex> lock(append_offset_reserve_mutex_); 57 3 : auto out = append_offset_reserve_.at(merge_id); 58 3 : append_offset_reserve_.erase(merge_id); 59 6 : return out; 60 : } 61 : 62 : } // namespace gkfs::metadata