From f7ce22ed0ba4a758bdc7de0f21b6d0cb45a866b1 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 03:58:12 +0100 Subject: deflate blob chunks --- src/swarm/stats.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/swarm/stats.rs') diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs index ed91db0..6332901 100644 --- a/src/swarm/stats.rs +++ b/src/swarm/stats.rs @@ -133,6 +133,10 @@ pub(crate) struct Relay { pub(crate) framed: u64, pub(crate) framing_bytes: u64, pub(crate) framing_id_bytes: u64, + /// Sync messages deflated (`compress`), their bytes before and after. + pub(crate) deflated: u64, + pub(crate) deflated_from: u64, + pub(crate) deflated_to: u64, /// Sync messages received that carried changes, all of which we had already, and /// their payload's bytes: changes that came twice. Of those, how many came along a /// writer's tree (`SyncEnvelope::writer`), and how many were taken as delivered by @@ -254,6 +258,14 @@ impl NodeStats { self.lock().relay.tree_forwards += 1; } + /// A sync message of `from` bytes went out deflated to `to`. + pub(crate) fn deflated(&self, from: usize, to: usize) { + let mut inner = self.lock(); + inner.relay.deflated += 1; + inner.relay.deflated_from += from as u64; + inner.relay.deflated_to += to as u64; + } + /// A sync message went out whose envelope added `bytes` to its Automerge message, /// `ids` of them the epoch. pub(crate) fn sync_framing(&self, bytes: usize, ids: usize) { -- cgit v1.3.1