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:
|
private:
|
||||||
std::string source_path_;
|
std::string source_path_;
|
||||||
data_buffer data_buffer_;
|
|
||||||
|
private:
|
||||||
|
data_buffer read_buffer_;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
[[nodiscard]] auto
|
[[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 */)
|
auto ring_buffer_open_file::get_read_buffer(std::size_t /* chunk */)
|
||||||
-> data_buffer & {
|
-> data_buffer & {
|
||||||
return data_buffer_;
|
return read_buffer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ring_buffer_open_file::on_check_start() -> bool {
|
auto ring_buffer_open_file::on_check_start() -> bool {
|
||||||
@ -113,20 +113,23 @@ void ring_buffer_open_file::on_destroy() {
|
|||||||
nf_->close();
|
nf_->close();
|
||||||
nf_.reset();
|
nf_.reset();
|
||||||
|
|
||||||
if (not utils::file::file(get_source_path()).remove()) {
|
if (utils::file::file(get_source_path()).remove()) {
|
||||||
utils::error::raise_api_path_error(
|
return;
|
||||||
function_name, get_api_path(), get_source_path(),
|
|
||||||
utils::get_last_error_code(), "failed to delete file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(
|
auto ring_buffer_open_file::use_buffer(
|
||||||
std::size_t chunk,
|
std::size_t chunk,
|
||||||
std::function<api_error(const data_buffer &data)> func) -> api_error {
|
std::function<api_error(const data_buffer &data)> func) -> api_error {
|
||||||
data_buffer buffer;
|
data_buffer buffer;
|
||||||
|
buffer.resize(get_chunk_size());
|
||||||
|
|
||||||
auto res = do_io([&]() -> api_error {
|
auto res = do_io([&]() -> api_error {
|
||||||
std::size_t bytes_read{};
|
std::size_t bytes_read{};
|
||||||
buffer.resize(get_chunk_size());
|
|
||||||
auto result =
|
auto result =
|
||||||
nf_->read(buffer, (chunk % get_read_state_size()) * get_chunk_size(),
|
nf_->read(buffer, (chunk % get_read_state_size()) * get_chunk_size(),
|
||||||
&bytes_read)
|
&bytes_read)
|
||||||
|
Reference in New Issue
Block a user