refactor
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
@ -49,7 +49,9 @@ public:
|
||||
|
||||
private:
|
||||
std::string source_path_;
|
||||
data_buffer data_buffer_;
|
||||
|
||||
private:
|
||||
data_buffer read_buffer_;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] auto
|
||||
|
@ -56,7 +56,7 @@ auto ring_buffer_open_file::can_handle_file(std::uint64_t file_size,
|
||||
|
||||
auto ring_buffer_open_file::get_read_buffer(std::size_t /* chunk */)
|
||||
-> data_buffer & {
|
||||
return data_buffer_;
|
||||
return read_buffer_;
|
||||
}
|
||||
|
||||
auto ring_buffer_open_file::on_check_start() -> bool {
|
||||
@ -113,20 +113,23 @@ void ring_buffer_open_file::on_destroy() {
|
||||
nf_->close();
|
||||
nf_.reset();
|
||||
|
||||
if (not utils::file::file(get_source_path()).remove()) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, get_api_path(), get_source_path(),
|
||||
utils::get_last_error_code(), "failed to delete file");
|
||||
if (utils::file::file(get_source_path()).remove()) {
|
||||
return;
|
||||
}
|
||||
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, get_api_path(), get_source_path(),
|
||||
utils::get_last_error_code(), "failed to delete file");
|
||||
}
|
||||
|
||||
auto ring_buffer_open_file::use_buffer(
|
||||
std::size_t chunk,
|
||||
std::function<api_error(const data_buffer &data)> func) -> api_error {
|
||||
data_buffer buffer;
|
||||
buffer.resize(get_chunk_size());
|
||||
|
||||
auto res = do_io([&]() -> api_error {
|
||||
std::size_t bytes_read{};
|
||||
buffer.resize(get_chunk_size());
|
||||
auto result =
|
||||
nf_->read(buffer, (chunk % get_read_state_size()) * get_chunk_size(),
|
||||
&bytes_read)
|
||||
|
Reference in New Issue
Block a user