|
|
|
@ -39,7 +39,6 @@
|
|
|
|
|
#include "utils/file.hpp"
|
|
|
|
|
#include "utils/path.hpp"
|
|
|
|
|
#include "utils/polling.hpp"
|
|
|
|
|
#include "utils/time.hpp"
|
|
|
|
|
|
|
|
|
|
namespace repertory {
|
|
|
|
|
file_manager::file_manager(app_config &config, i_provider &provider)
|
|
|
|
@ -220,7 +219,7 @@ auto file_manager::get_open_file_by_handle(std::uint64_t handle) const
|
|
|
|
|
-> std::shared_ptr<i_closeable_open_file> {
|
|
|
|
|
auto file_iter =
|
|
|
|
|
std::find_if(open_file_lookup_.begin(), open_file_lookup_.end(),
|
|
|
|
|
[&handle](const auto &item) -> bool {
|
|
|
|
|
[&handle](auto &&item) -> bool {
|
|
|
|
|
return item.second->has_handle(handle);
|
|
|
|
|
});
|
|
|
|
|
return (file_iter == open_file_lookup_.end()) ? nullptr : file_iter->second;
|
|
|
|
@ -381,11 +380,10 @@ auto file_manager::open(const std::string &api_path, bool directory,
|
|
|
|
|
return open(api_path, directory, ofd, handle, file, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto file_manager::open(const std::string &api_path, bool directory,
|
|
|
|
|
const open_file_data &ofd, std::uint64_t &handle,
|
|
|
|
|
std::shared_ptr<i_open_file> &file,
|
|
|
|
|
std::shared_ptr<i_closeable_open_file> closeable_file)
|
|
|
|
|
-> api_error {
|
|
|
|
|
auto file_manager::open(
|
|
|
|
|
const std::string &api_path, bool directory, const open_file_data &ofd,
|
|
|
|
|
std::uint64_t &handle, std::shared_ptr<i_open_file> &file,
|
|
|
|
|
std::shared_ptr<i_closeable_open_file> closeable_file) -> api_error {
|
|
|
|
|
REPERTORY_USES_FUNCTION_NAME();
|
|
|
|
|
|
|
|
|
|
const auto create_and_add_handle =
|
|
|
|
@ -437,7 +435,7 @@ auto file_manager::open(const std::string &api_path, bool directory,
|
|
|
|
|
auto ring_size{ring_buffer_file_size / chunk_size};
|
|
|
|
|
|
|
|
|
|
const auto get_download_type = [&](download_type type) -> download_type {
|
|
|
|
|
if (directory || fsi.size == 0U) {
|
|
|
|
|
if (directory || fsi.size == 0U || is_processing(api_path)) {
|
|
|
|
|
return download_type::default_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -749,8 +747,8 @@ auto file_manager::rename_directory(const std::string &from_api_path,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto file_manager::rename_file(const std::string &from_api_path,
|
|
|
|
|
const std::string &to_api_path, bool overwrite)
|
|
|
|
|
-> api_error {
|
|
|
|
|
const std::string &to_api_path,
|
|
|
|
|
bool overwrite) -> api_error {
|
|
|
|
|
if (not provider_.is_rename_supported()) {
|
|
|
|
|
return api_error::not_implemented;
|
|
|
|
|
}
|
|
|
|
|