diff options
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/host.rs | 14 | ||||
| -rw-r--r-- | src/state/mod.rs | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/state/host.rs b/src/state/host.rs index 0b2b27d..34ed7ed 100644 --- a/src/state/host.rs +++ b/src/state/host.rs @@ -30,7 +30,7 @@ impl AppState { replica.signatures = replica.signatures.kept_for(&replica.doc); if let Some(key) = &self.node_key { let replica = &mut *replica; - let own = self.remake.own_actors(); + let own = self.own_writers.all(); replica .signatures .sign_own_actors(&mut replica.doc, key, &own); @@ -110,7 +110,7 @@ impl AppState { /// of the document (past `SMALL_DROP`), wait for another's. const BIG_DROP: usize = 100; const SMALL_DROP: usize = 10; - let own = self.remake.own_actors(); + let own = self.own_writers.all(); // Another member to hear it from: a node with one neighbour, the one telling, has // only its word (a swarm of two, a leaf), and waiting would hold the drop for good. let another = crate::swarm::topology::our_neighbours(self) @@ -221,7 +221,7 @@ impl AppState { }, }) .collect(); - state.remake.add_own_actor(actor); + state.own_writers.add(actor); let epoch = replica.epoch; let old = state.swap_document(&mut replica, epoch, fresh); { @@ -297,6 +297,10 @@ impl Host for AppState { &self.remake } + fn own_writers(&self) -> &crate::document::own::OwnWriters { + &self.own_writers + } + fn clock(&self) -> Arc<crate::clock::Clock> { Arc::clone(&self.clock) } @@ -533,7 +537,7 @@ impl Host for AppState { // What it replayed, vouched for at once. if let Some(key) = &state.node_key { let replica = &mut *replica; - let own = state.remake.own_actors(); + let own = state.own_writers.all(); replica .signatures .sign_own_actors(&mut replica.doc, key, &own); @@ -617,7 +621,7 @@ impl Host for AppState { ) .map(|outcome| { if let Some(actor) = outcome.fresh_actor { - state.remake.add_own_actor(actor); + state.own_writers.add(actor); } }) .map_err(|error| format!("{error:#}")) diff --git a/src/state/mod.rs b/src/state/mod.rs index a812b91..4187654 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -111,6 +111,9 @@ pub(crate) struct AppState { /// Per-node remake state (prebuilt snapshots, switch status, archive). pub(crate) remake: Arc<RemakeState>, + /// The writers this node writes or wrote under in its current document. + pub(crate) own_writers: Arc<crate::document::own::OwnWriters>, + /// Pre-shared key every member must prove in the handshake; None admits any node /// that reaches us. pub(crate) swarm_key: Option<Arc<crate::swarm::auth::SwarmKey>>, |
