From 7a24cc54f878f2860b977e131df6bc921f8a8d6f Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 16 Nov 2023 08:08:03 -0600 Subject: [PATCH] refactor --- include/file_manager/file_manager.hpp | 13 +++++-------- include/file_manager/i_file_manager.hpp | 7 ------- src/file_manager/file_manager.cpp | 6 ------ 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/include/file_manager/file_manager.hpp b/include/file_manager/file_manager.hpp index d7106c55..ac6c429c 100644 --- a/include/file_manager/file_manager.hpp +++ b/include/file_manager/file_manager.hpp @@ -117,18 +117,18 @@ public: i_provider &provider_; private: - api_error error_ = api_error::success; + api_error error_{api_error::success}; mutable std::mutex error_mtx_; - stop_type io_stop_requested_ = false; + stop_type io_stop_requested_{false}; std::unique_ptr io_thread_; protected: std::unordered_map> active_downloads_; mutable std::recursive_mutex file_mtx_; - std::atomic last_access_ = - std::chrono::system_clock::now(); - bool modified_ = false; + std::atomic last_access_{ + std::chrono::system_clock::now()}; + bool modified_{false}; native_file_ptr nf_; mutable std::mutex io_thread_mtx_; std::condition_variable io_thread_notify_; @@ -539,9 +539,6 @@ public: const open_file_data &ofd, std::uint64_t &handle, std::shared_ptr &f) -> api_error; - auto perform_locked_operation(locked_operation_callback locked_operation) - -> bool override; - [[nodiscard]] auto remove_file(const std::string &api_path) -> api_error; [[nodiscard]] auto rename_directory(const std::string &from_api_path, diff --git a/include/file_manager/i_file_manager.hpp b/include/file_manager/i_file_manager.hpp index 97270253..b4cb154f 100644 --- a/include/file_manager/i_file_manager.hpp +++ b/include/file_manager/i_file_manager.hpp @@ -30,9 +30,6 @@ class i_provider; class i_file_manager { INTERFACE_SETUP(i_file_manager); -public: - using locked_operation_callback = std::function; - public: [[nodiscard]] virtual auto evict_file(const std::string &api_path) -> bool = 0; @@ -49,10 +46,6 @@ public: [[nodiscard]] virtual auto is_processing(const std::string &api_path) const -> bool = 0; - virtual auto - perform_locked_operation(locked_operation_callback locked_operation) - -> bool = 0; - virtual void update_used_space(std::uint64_t &used_space) const = 0; }; } // namespace repertory diff --git a/src/file_manager/file_manager.cpp b/src/file_manager/file_manager.cpp index b6730333..721fa884 100644 --- a/src/file_manager/file_manager.cpp +++ b/src/file_manager/file_manager.cpp @@ -400,12 +400,6 @@ auto file_manager::open(const std::string &api_path, bool directory, return api_error::success; } -auto file_manager::perform_locked_operation( - locked_operation_callback locked_operation) -> bool { - recur_mutex_lock open_lock(open_file_mtx_); - return locked_operation(provider_); -} - void file_manager::queue_upload(const i_open_file &o) { return queue_upload(o.get_api_path(), o.get_source_path(), false); }