Complete ring buffer and direct download support #26

This commit is contained in:
Scott E. Graves 2024-12-23 09:42:41 -06:00
parent 29d83fc5e8
commit 8c412a6cff
3 changed files with 7 additions and 4 deletions

View File

@ -69,7 +69,8 @@ auto direct_open_file::read(std::size_t read_size, std::uint64_t read_offset,
(2U * utils::time::NANOS_PER_SECOND)) {
last_progress_ = utils::time::get_time_now();
auto progress = (static_cast<double>(read_offset + read_size) /
static_cast<double>(fsi_.size) * 100.0);
static_cast<double>(fsi_.size)) *
100.0;
event_system::instance().raise<download_progress>(
fsi_.api_path, fsi_.source_path, progress);
}

View File

@ -246,7 +246,8 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active,
read_state_.count(), get_api_error());
if (get_api_error() == api_error::success) {
auto progress = (static_cast<double>(read_state_.count()) /
static_cast<double>(read_state_.size()) * 100.0);
static_cast<double>(read_state_.size())) *
100.0;
event_system::instance().raise<download_progress>(
fsi_.api_path, fsi_.source_path, progress);
if (read_state_.all() && not notified_) {

View File

@ -209,8 +209,9 @@ auto ring_buffer_open_file::download_chunk(std::size_t chunk, bool skip_active)
chunk_lock.lock();
if (res == api_error::success) {
auto progress = (static_cast<double>(chunk) /
static_cast<double>(total_chunks_) * 100.0);
auto progress =
(static_cast<double>(chunk) / static_cast<double>(total_chunks_)) *
100.0;
event_system::instance().raise<download_progress>(fsi_.api_path,
source_path_, progress);
res = (chunk >= ring_begin_ && chunk <= ring_end_)