aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/tree.rs')
-rw-r--r--src/swarm/tree.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/swarm/tree.rs b/src/swarm/tree.rs
index 064f5b9..de865de 100644
--- a/src/swarm/tree.rs
+++ b/src/swarm/tree.rs
@@ -707,6 +707,42 @@ pub(crate) async fn forward(
Some(plan)
}
+/// Writers' trees as the way changes reach every member
+/// (`swarm::dissemination::Dissemination`): `plan`, `forward` and `note_arrival` above.
+pub(crate) struct WritersTrees;
+
+#[async_trait::async_trait]
+impl crate::swarm::dissemination::Dissemination for WritersTrees {
+ fn name(&self) -> &'static str {
+ "writers-trees"
+ }
+
+ async fn plan(&self, state: &AppState, writer: u64) -> Option<Plan> {
+ plan(state, writer).await
+ }
+
+ async fn forward(
+ &self,
+ state: &AppState,
+ writer: u64,
+ from: &str,
+ changes: &[crate::document::ChangeHash],
+ ) -> Option<Plan> {
+ forward(state, writer, from, changes).await
+ }
+
+ async fn note_arrival(
+ &self,
+ state: &AppState,
+ peer: &str,
+ writer: Option<u64>,
+ carried: bool,
+ authors: &[(String, Vec<crate::document::ChangeHash>)],
+ ) {
+ note_arrival(state, peer, writer, carried, authors).await;
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;