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

This commit is contained in:
2024-12-26 20:20:44 -06:00
parent c7870fdab4
commit 45a5e7b9aa
2 changed files with 17 additions and 7 deletions

View File

@ -67,6 +67,8 @@ private:
private:
void background_reader_thread();
[[nodiscard]] auto check_allocation() -> api_error;
auto download_chunk(std::size_t chunk, bool skip_active) -> api_error;
public:

View File

@ -87,15 +87,19 @@ ring_buffer_open_file::~ring_buffer_open_file() {
close();
nf_->close();
if (not utils::file::file(source_path_).remove()) {
utils::error::raise_api_path_error(
function_name, fsi_.api_path, source_path_,
utils::get_last_error_code(), "failed to delete file");
if (nf_) {
nf_->close();
if (not utils::file::file(source_path_).remove()) {
utils::error::raise_api_path_error(
function_name, fsi_.api_path, source_path_,
utils::get_last_error_code(), "failed to delete file");
}
}
reader_thread_->join();
reader_thread_.reset();
if (reader_thread_) {
reader_thread_->join();
reader_thread_.reset();
}
}
void ring_buffer_open_file::background_reader_thread() {
@ -148,6 +152,10 @@ 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);
}
auto ring_buffer_open_file::check_allocation() -> api_error {
}
auto ring_buffer_open_file::close() -> bool {
stop_requested_ = true;