MCPcopy Create free account
hub / github.com/attermann/microReticulum / get_segment_progress

Method get_segment_progress

src/microReticulum/Resource.cpp:1405–1415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1403}
1404
1405float Resource::get_segment_progress() const {
1406 assert(_object);
1407 if (_object->_status == Type::Resource::COMPLETE
1408 && _object->_segment_index == _object->_total_segments) {
1409 return 1.0f;
1410 }
1411 if (_object->_total_parts == 0) return 0.0f;
1412 const double processed = _object->_initiator ? _object->_sent_parts : _object->_received_count;
1413 const double progress = processed / static_cast<double>(_object->_total_parts);
1414 return static_cast<float>(progress > 1.0 ? 1.0 : progress);
1415}
1416
1417size_t Resource::get_transfer_size() const {
1418 assert(_object);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected