aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-04 21:07:42 +0100
committertv <tv@krebsco.de>2026-11-04 21:07:42 +0100
commita8762b78d327e97c3c818842e5a948ba118fefd8 (patch)
tree60308cecf72a0fa247f807746588a23f136f89ab /src/swarm/sync.rs
parent9f4820d5d121025e908da9ca98783f2827044768 (diff)
benchmark what sync bytes are
Diffstat (limited to 'src/swarm/sync.rs')
-rw-r--r--src/swarm/sync.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index 07c990c..04d06de 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -406,6 +406,10 @@ pub(crate) async fn handle_sync(
let payload_len = message.0.len();
let message = crate::document::sync::decode(&message)?;
let carried = message.carries_changes();
+ let sizes = if carried { message.sizes() } else { (0, 0) };
+ if carried {
+ stats.carrying(sizes);
+ }
let mut replica = doc.blocking_write();
// Authoritative check, under the same lock as the apply: the document may
@@ -447,7 +451,7 @@ pub(crate) async fn handle_sync(
peer_state.sync.came_from_peer(&replica.doc, &heads_before);
}
if carried && !changed {
- stats.nothing_new(payload_len, writer.is_some(), delivered);
+ stats.nothing_new(payload_len, writer.is_some(), delivered, sizes);
}
// Whose they are, to pass them on along their writers' trees, however they
// came (along a tree, with an answer, pulled).