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

This commit is contained in:
2024-12-26 21:09:41 -06:00
parent 467d22fe44
commit cc70aadc03
4 changed files with 16 additions and 16 deletions

View File

@ -77,10 +77,10 @@ private:
stop_type stop_requested_{false}; stop_type stop_requested_{false};
private: private:
[[nodiscard]] auto adjust_cache_size(std::uint64_t file_size, bool shrink) [[nodiscard]] auto adjust_cache_size(std::uint64_t file_size,
-> api_error; bool shrink) -> api_error;
[[nodiscard]] auto check_allocation() -> api_error; [[nodiscard]] auto check_start() -> api_error;
void download_chunk(std::size_t chunk, bool skip_active, bool should_reset); void download_chunk(std::size_t chunk, bool skip_active, bool should_reset);
@ -110,12 +110,12 @@ public:
return true; return true;
} }
[[nodiscard]] auto native_operation(native_operation_callback callback) [[nodiscard]] auto
-> api_error override; native_operation(native_operation_callback callback) -> api_error override;
[[nodiscard]] auto native_operation(std::uint64_t new_file_size, [[nodiscard]] auto
native_operation_callback callback) native_operation(std::uint64_t new_file_size,
-> api_error override; native_operation_callback callback) -> api_error override;
void remove(std::uint64_t handle) override; void remove(std::uint64_t handle) override;

View File

@ -63,7 +63,7 @@ private:
stop_type stop_requested_{false}; stop_type stop_requested_{false};
private: private:
[[nodiscard]] auto check_allocation() -> api_error; [[nodiscard]] auto check_start() -> api_error;
auto download_chunk(std::size_t chunk, bool skip_active) -> api_error; auto download_chunk(std::size_t chunk, bool skip_active) -> api_error;

View File

@ -158,7 +158,7 @@ auto open_file::adjust_cache_size(std::uint64_t file_size,
return set_api_error(res); return set_api_error(res);
} }
auto open_file::check_allocation() -> api_error { auto open_file::check_start() -> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
unique_recur_mutex_lock file_lock(file_mtx_); unique_recur_mutex_lock file_lock(file_mtx_);
@ -410,7 +410,7 @@ auto open_file::native_operation(
return set_api_error(api_error::download_stopped); return set_api_error(api_error::download_stopped);
} }
auto res = check_allocation(); auto res = check_start();
if (res != api_error::success) { if (res != api_error::success) {
return res; return res;
} }
@ -432,7 +432,7 @@ auto open_file::native_operation(
return set_api_error(api_error::download_stopped); return set_api_error(api_error::download_stopped);
} }
auto res = check_allocation(); auto res = check_start();
if (res != api_error::success) { if (res != api_error::success) {
return res; return res;
} }
@ -548,7 +548,7 @@ auto open_file::read(std::size_t read_size, std::uint64_t read_offset,
return api_error::success; return api_error::success;
} }
auto res = check_allocation(); auto res = check_start();
if (res != api_error::success) { if (res != api_error::success) {
return res; return res;
} }
@ -711,7 +711,7 @@ auto open_file::write(std::uint64_t write_offset, const data_buffer &data,
return set_api_error(api_error::download_stopped); return set_api_error(api_error::download_stopped);
} }
auto res = check_allocation(); auto res = check_start();
if (res != api_error::success) { if (res != api_error::success) {
return res; return res;
} }

View File

@ -86,7 +86,7 @@ auto ring_buffer_open_file::can_handle_file(std::uint64_t file_size,
return file_size >= (static_cast<std::uint64_t>(ring_size) * chunk_size); return file_size >= (static_cast<std::uint64_t>(ring_size) * chunk_size);
} }
auto ring_buffer_open_file::check_allocation() -> api_error { auto ring_buffer_open_file::check_start() -> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
if (nf_) { if (nf_) {
@ -304,7 +304,7 @@ auto ring_buffer_open_file::read(std::size_t read_size,
read_offset = read_offset - (begin_chunk * chunk_size_); read_offset = read_offset - (begin_chunk * chunk_size_);
unique_mutex_lock read_lock(read_mtx_); unique_mutex_lock read_lock(read_mtx_);
auto res = check_allocation(); auto res = check_start();
if (res != api_error::success) { if (res != api_error::success) {
return res; return res;
} }