refactor
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2023-11-16 08:08:03 -06:00
parent 80f6e3c272
commit 7a24cc54f8
3 changed files with 5 additions and 21 deletions

View File

@ -117,18 +117,18 @@ public:
i_provider &provider_; i_provider &provider_;
private: private:
api_error error_ = api_error::success; api_error error_{api_error::success};
mutable std::mutex error_mtx_; mutable std::mutex error_mtx_;
stop_type io_stop_requested_ = false; stop_type io_stop_requested_{false};
std::unique_ptr<std::thread> io_thread_; std::unique_ptr<std::thread> io_thread_;
protected: protected:
std::unordered_map<std::size_t, std::shared_ptr<download>> std::unordered_map<std::size_t, std::shared_ptr<download>>
active_downloads_; active_downloads_;
mutable std::recursive_mutex file_mtx_; mutable std::recursive_mutex file_mtx_;
std::atomic<std::chrono::system_clock::time_point> last_access_ = std::atomic<std::chrono::system_clock::time_point> last_access_{
std::chrono::system_clock::now(); std::chrono::system_clock::now()};
bool modified_ = false; bool modified_{false};
native_file_ptr nf_; native_file_ptr nf_;
mutable std::mutex io_thread_mtx_; mutable std::mutex io_thread_mtx_;
std::condition_variable io_thread_notify_; std::condition_variable io_thread_notify_;
@ -539,9 +539,6 @@ public:
const open_file_data &ofd, std::uint64_t &handle, const open_file_data &ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &f) -> api_error; std::shared_ptr<i_open_file> &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 remove_file(const std::string &api_path) -> api_error;
[[nodiscard]] auto rename_directory(const std::string &from_api_path, [[nodiscard]] auto rename_directory(const std::string &from_api_path,

View File

@ -30,9 +30,6 @@ class i_provider;
class i_file_manager { class i_file_manager {
INTERFACE_SETUP(i_file_manager); INTERFACE_SETUP(i_file_manager);
public:
using locked_operation_callback = std::function<bool(i_provider &)>;
public: public:
[[nodiscard]] virtual auto evict_file(const std::string &api_path) [[nodiscard]] virtual auto evict_file(const std::string &api_path)
-> bool = 0; -> bool = 0;
@ -49,10 +46,6 @@ public:
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const [[nodiscard]] virtual auto is_processing(const std::string &api_path) const
-> bool = 0; -> 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; virtual void update_used_space(std::uint64_t &used_space) const = 0;
}; };
} // namespace repertory } // namespace repertory

View File

@ -400,12 +400,6 @@ auto file_manager::open(const std::string &api_path, bool directory,
return api_error::success; 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) { void file_manager::queue_upload(const i_open_file &o) {
return queue_upload(o.get_api_path(), o.get_source_path(), false); return queue_upload(o.get_api_path(), o.get_source_path(), false);
} }