Complete ring buffer and direct download support #26
This commit is contained in:
parent
29d83fc5e8
commit
8c412a6cff
@ -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)) {
|
(2U * utils::time::NANOS_PER_SECOND)) {
|
||||||
last_progress_ = utils::time::get_time_now();
|
last_progress_ = utils::time::get_time_now();
|
||||||
auto progress = (static_cast<double>(read_offset + read_size) /
|
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>(
|
event_system::instance().raise<download_progress>(
|
||||||
fsi_.api_path, fsi_.source_path, progress);
|
fsi_.api_path, fsi_.source_path, progress);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,8 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active,
|
|||||||
read_state_.count(), get_api_error());
|
read_state_.count(), get_api_error());
|
||||||
if (get_api_error() == api_error::success) {
|
if (get_api_error() == api_error::success) {
|
||||||
auto progress = (static_cast<double>(read_state_.count()) /
|
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>(
|
event_system::instance().raise<download_progress>(
|
||||||
fsi_.api_path, fsi_.source_path, progress);
|
fsi_.api_path, fsi_.source_path, progress);
|
||||||
if (read_state_.all() && not notified_) {
|
if (read_state_.all() && not notified_) {
|
||||||
|
@ -209,8 +209,9 @@ auto ring_buffer_open_file::download_chunk(std::size_t chunk, bool skip_active)
|
|||||||
|
|
||||||
chunk_lock.lock();
|
chunk_lock.lock();
|
||||||
if (res == api_error::success) {
|
if (res == api_error::success) {
|
||||||
auto progress = (static_cast<double>(chunk) /
|
auto progress =
|
||||||
static_cast<double>(total_chunks_) * 100.0);
|
(static_cast<double>(chunk) / static_cast<double>(total_chunks_)) *
|
||||||
|
100.0;
|
||||||
event_system::instance().raise<download_progress>(fsi_.api_path,
|
event_system::instance().raise<download_progress>(fsi_.api_path,
|
||||||
source_path_, progress);
|
source_path_, progress);
|
||||||
res = (chunk >= ring_begin_ && chunk <= ring_end_)
|
res = (chunk >= ring_begin_ && chunk <= ring_end_)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user