@@ -149,6 +149,8 @@ class PeerReplayer {
149149 uint64_t renamed_snap_count = 0 ;
150150 monotime last_synced = clock::zero();
151151 boost::optional<double > last_sync_duration;
152+ boost::optional<uint64_t > last_sync_bytes; // last sync bytes for display in status
153+ uint64_t sync_bytes = 0 ; // sync bytes counter, independently for each directory sync.
152154 };
153155
154156 void _inc_failed_count (const std::string &dir_root) {
@@ -187,6 +189,8 @@ class PeerReplayer {
187189 const std::string &snap_name) {
188190 std::scoped_lock locker (m_lock);
189191 _set_last_synced_snap (dir_root, snap_id, snap_name);
192+ auto &sync_stat = m_snap_sync_stats.at (dir_root);
193+ sync_stat.sync_bytes = 0 ;
190194 }
191195 void set_current_syncing_snap (const std::string &dir_root, uint64_t snap_id,
192196 const std::string &snap_name) {
@@ -216,9 +220,14 @@ class PeerReplayer {
216220 auto &sync_stat = m_snap_sync_stats.at (dir_root);
217221 sync_stat.last_synced = clock::now ();
218222 sync_stat.last_sync_duration = duration;
223+ sync_stat.last_sync_bytes = sync_stat.sync_bytes ;
219224 ++sync_stat.synced_snap_count ;
220225 }
221-
226+ void inc_sync_bytes (const std::string &dir_root, const uint64_t & b) {
227+ std::scoped_lock locker (m_lock);
228+ auto &sync_stat = m_snap_sync_stats.at (dir_root);
229+ sync_stat.sync_bytes += b;
230+ }
222231 bool should_backoff (const std::string &dir_root, int *retval) {
223232 if (m_fs_mirror->is_blocklisted ()) {
224233 *retval = -EBLOCKLISTED;
0 commit comments