aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 13:24:34 +0000
committertv <tv@krebsco.de>2026-11-29 13:24:34 +0000
commit61fb06c420d5e481badc8a9d3252b90cf9013746 (patch)
treed90578948fc7b581594621a13dae9be0cd3ad2f8 /src/document
parent2d31675f5c2c3b3475be89558c55a8a6e604df49 (diff)
federation: passing a set of events on
What two nodes say to each other of their sets (store::passing), with nothing kept of a peer between messages: where a node stands, its store's checkpoint and heads and the fingerprint of all its names; ranges (document::ranges, whose messages serialize), where fingerprints differ; its heads, where they differ and the fingerprints don't; the names it lacks and would have; events and entries, no more than 1 MiB a message. What comes is offered to the store or put as an entry, and for what the store then waits on and doesn't hold (Store::lacks) the node asks in turn. Sets that wrote apart come to hold the same, over seeds; what a node refuses of its own reaches others through it. Used by nothing yet: no node carries a set.
Diffstat (limited to 'src/document')
-rw-r--r--src/document/ranges.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/document/ranges.rs b/src/document/ranges.rs
index 8ae71e9..b142f90 100644
--- a/src/document/ranges.rs
+++ b/src/document/ranges.rs
@@ -23,6 +23,7 @@
use std::collections::BTreeSet;
use std::ops::Bound;
+use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
/// What is reconciled: 32 bytes, in the order of their bytes.
@@ -36,7 +37,7 @@ const FEW: usize = 2 * PARTS;
/// What stands for the names of a range: the same for the same names, and, but for
/// names made to collide, for no others.
-#[derive(Clone, Copy, PartialEq, Eq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub(crate) struct Fingerprint(pub(crate) [u8; 16]);
/// The names of a range added up, and how many.
@@ -82,7 +83,7 @@ pub(crate) type Upper = Option<Name>;
/// What a message says of one range, which begins where the part before ended (the
/// first, before every name) and ends at `upper`.
-#[derive(Clone, PartialEq, Eq, Debug)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub(crate) enum Part {
/// Nothing to say of it: it is done, or left for another message.
Skip { upper: Upper },
@@ -111,7 +112,7 @@ impl Part {
}
/// Parts in order, the last ending after every name.
-#[derive(Clone, PartialEq, Eq, Debug, Default)]
+#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize)]
pub(crate) struct Message(pub(crate) Vec<Part>);
/// What a node makes of a message.