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

This commit is contained in:
Scott E. Graves 2024-12-22 19:00:22 -06:00
parent 73a8b2c9fc
commit 13f6c10e6e

View File

@ -172,17 +172,15 @@ void ring_buffer_open_file::forward(std::size_t count) {
ring_state_.set(0U, ring_state_.size(), true);
ring_pos_ += count;
ring_begin_ += added;
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
} else {
for (std::size_t idx = 0U; idx < added; ++idx) {
ring_state_[(ring_begin_ + idx) % ring_state_.size()] = true;
}
ring_begin_ += added;
ring_pos_ += count;
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
}
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
}
chunk_notify_.notify_all();
@ -218,17 +216,16 @@ void ring_buffer_open_file::reverse(std::size_t count) {
ring_state_.set(0U, ring_state_.size(), true);
ring_pos_ -= count;
ring_begin_ = ring_pos_;
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
} else {
for (std::size_t idx = 0U; idx < removed; ++idx) {
ring_state_[(ring_end_ - idx) % ring_state_.size()] = true;
}
ring_begin_ -= removed;
ring_pos_ -= count;
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
}
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + ring_state_.size() - 1U);
}
chunk_notify_.notify_all();