aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-30 13:58:03 +0000
committertv <tv@krebsco.de>2026-11-30 13:58:03 +0000
commitaf9de78d7de36848f6ff115c9710fb90d2468af2 (patch)
tree57013cd112c7928d72e2a6e2c0c7fb4a55edc92b /src/state
parent27b0fb294c47fea75359c3abadab56cd74c93b33 (diff)
swarm: a node says the kind of the document it holds
In its handshakes, and checks a peer's against it (AppState::kind): a set of events where one carries its store (Holding::of_a_set), else Automerge's, as it was for every node.
Diffstat (limited to 'src/state')
-rw-r--r--src/state/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs
index 604f6ae..36dab9d 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -377,6 +377,16 @@ impl AppState {
*self.closing.borrow()
}
+ /// The kind of this node's document (`document::KIND`, or a set of events where
+ /// one carries its store).
+ pub(crate) fn kind(&self) -> &'static str {
+ #[cfg(feature = "federation")]
+ if self.holding.of_a_set() {
+ return self.holding.kind();
+ }
+ crate::document::KIND
+ }
+
pub(crate) fn local_id(&self) -> &str {
self.transport.local_id()
}