aboutsummaryrefslogtreecommitdiffstats
path: root/src/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/state')
-rw-r--r--src/state/mod.rs15
-rw-r--r--src/state/peer.rs4
2 files changed, 13 insertions, 6 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs
index 21478de..0ffa91e 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -381,14 +381,17 @@ 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 {
+ /// The kinds of document this node holds, which it says in handshakes: more than
+ /// one where it holds its store in both (`Holding::kinds`).
+ pub(crate) fn kinds(&self) -> &'static [&'static str] {
#[cfg(feature = "federation")]
- if self.holding.of_a_set() {
- return self.holding.kind();
+ {
+ self.holding.kinds()
+ }
+ #[cfg(not(feature = "federation"))]
+ {
+ &[crate::document::KIND]
}
- crate::document::KIND
}
/// Whether this node's document is a set of events (`federation::store::set`):
diff --git a/src/state/peer.rs b/src/state/peer.rs
index 721a754..356736a 100644
--- a/src/state/peer.rs
+++ b/src/state/peer.rs
@@ -92,6 +92,9 @@ pub(crate) struct PeerState {
/// The party its handshakes name, in a swarm holding a store (`swarm::peer::members`).
#[cfg(feature = "federation")]
pub(crate) party: Option<String>,
+ /// The kind of document its handshakes say it holds, of those this node holds: what
+ /// this node says to it in turn, and passes on to it (`swarm::peer::inbound`).
+ pub(crate) kind: Option<&'static str>,
pub(crate) hello_state: HelloState,
/// Wait between unanswered HELLOs; reset whenever a new handshake starts.
pub(crate) hello_backoff: Backoff,
@@ -339,6 +342,7 @@ impl PeerState {
tree_writer: None,
left: false,
hello_attempts: 0,
+ kind: None,
last_hello_at: None,
unreachable_since: None,
incidents: Incidents::default(),