diff options
| author | tv <tv@krebsco.de> | 2026-11-09 22:32:01 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-11 23:29:29 +0100 |
| commit | 61cb117a9b230371d7be36a15a055972ec7de56e (patch) | |
| tree | 12bee005f52d3355975045872fdf0cbcd3fc71b3 /src/state | |
| parent | 5b2232b14aba5d72f07b9d1ae889f9951d6d2569 (diff) | |
screen: write as a fresh actor when another node writes as this one
With --keep-actor, a node on a document file that ends with a clean stop
writes on as the actor the file names. Two nodes started on copies of
one file (a copied data directory, a restored disk image while the
original runs) both do, and both make that actor's next change number:
peers holding one refuse the other as forged, and everything built on
it.
screen::apply_bytes, the way every received change comes in, now looks
for a change of the actor the node writes as that the node doesn't hold:
only another node can have made it. The node then writes on as a fresh
actor at once, logs a warning, and its callers add the actor to the
node's own (RemakeState::add_own_actor), which the document file's
header follows. The change is judged as any other. lifecycle.md says not
to start a copy of a node's data directory with --keep-actor, and what
the switch leaves: what both wrote before stays refused where the
other's came first.
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/host.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state/host.rs b/src/state/host.rs index 8522657..5b52e1d 100644 --- a/src/state/host.rs +++ b/src/state/host.rs @@ -590,7 +590,11 @@ impl Host for AppState { Some(&mut replica.signatures), &mut crate::document::PatchLog::inactive(), ) - .map(|_| ()) + .map(|outcome| { + if let Some(actor) = outcome.fresh_actor { + state.remake.add_own_actor(actor); + } + }) .map_err(|error| format!("{error:#}")) }; replica.refresh_heads(); |
