aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/plumtree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/plumtree.rs')
-rw-r--r--src/swarm/plumtree.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/swarm/plumtree.rs b/src/swarm/plumtree.rs
index 9560b9f..340fa68 100644
--- a/src/swarm/plumtree.rs
+++ b/src/swarm/plumtree.rs
@@ -45,7 +45,7 @@ use async_trait::async_trait;
use tokio::time::Instant;
use tracing::debug;
-use crate::document::ChangeHash;
+use crate::document::UnitId;
use crate::locks::MutexExt;
use crate::state::AppState;
use crate::swarm::dissemination::{Dissemination, pass_on};
@@ -99,7 +99,7 @@ const SETTLE_UNKNOWN: Duration = Duration::from_secs(2);
#[derive(Default)]
pub(crate) struct PlumTree {
lazy: Mutex<HashSet<String>>,
- announced: Mutex<HashMap<ChangeHash, (String, Instant)>>,
+ announced: Mutex<HashMap<UnitId, (String, Instant)>>,
ahead_times: Mutex<HashMap<String, u32>>,
/// When we last grafted each link (`settling`).
grafted: Mutex<HashMap<String, Instant>>,
@@ -124,7 +124,7 @@ impl PlumTree {
/// pushes in a row: its link is the faster, by at least an announcement's delay
/// (`relay::ANNOUNCE_DELAY`), which a push over it doesn't wait. The changes are
/// forgotten as announced.
- fn ahead(&self, peer: &str, authors: &[(String, Vec<ChangeHash>)]) -> Option<String> {
+ fn ahead(&self, peer: &str, authors: &[(String, Vec<UnitId>)]) -> Option<String> {
let now = Instant::now();
let told: Vec<(String, Instant)> = {
let mut announced = self.announced.lock_or_recover();
@@ -186,7 +186,7 @@ impl PlumTree {
}
/// The changes, come another way, are forgotten as announced.
- fn forget_announced(&self, authors: &[(String, Vec<ChangeHash>)]) {
+ fn forget_announced(&self, authors: &[(String, Vec<UnitId>)]) {
let mut announced = self.announced.lock_or_recover();
for change in authors.iter().flat_map(|(_, changes)| changes) {
announced.remove(change);
@@ -241,7 +241,7 @@ impl Dissemination for PlumTree {
state: &AppState,
writer: u64,
from: &str,
- changes: &[ChangeHash],
+ changes: &[UnitId],
) -> Option<Plan> {
let plan = self.plan(state, writer).await?;
Some(pass_on(state, writer, from, changes, plan).await)
@@ -262,7 +262,7 @@ impl Dissemination for PlumTree {
peer: &str,
writer: Option<u64>,
carried: bool,
- authors: &[(String, Vec<ChangeHash>)],
+ authors: &[(String, Vec<UnitId>)],
) {
match writer {
Some(writer) if carried && authors.is_empty() => {
@@ -304,7 +304,7 @@ impl Dissemination for PlumTree {
}
/// The first to tell us of each head is the one noticed.
- fn announced(&self, peer: &str, heads: &[ChangeHash]) {
+ fn announced(&self, peer: &str, heads: &[UnitId]) {
let mut announced = self.announced.lock_or_recover();
if announced.len() + heads.len() > MAX_ANNOUNCED {
announced.clear();