summaryrefslogtreecommitdiffstats
path: root/src/remake/kind.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-24 23:06:03 +0200
committertv <tv@krebsco.de>2026-10-24 23:06:03 +0200
commitbbd6d81fbda85e80a63c5965f42d6aedf0adfb6c (patch)
tree2951003c83f6e72473b3534f8e1aa4e06e6628c0 /src/remake/kind.rs
parent6f59745d52c4b4c2b12bc4a6a815dfa2c73d4a25 (diff)
compact remake fixes base at the commit
Instead of fixing base heads at when proposed, compact fixes them when committing. This shrinks the window where writes can be lost if their author restarts to the switch delay; during replace and import remakes writes can still be lost during the voting period.
Diffstat (limited to 'src/remake/kind.rs')
-rw-r--r--src/remake/kind.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/remake/kind.rs b/src/remake/kind.rs
index 8131f7f..b36db4c 100644
--- a/src/remake/kind.rs
+++ b/src/remake/kind.rs
@@ -71,6 +71,14 @@ pub(crate) trait RemakeKind: Send + Sync + 'static {
/// Every node: where a user path written after the base goes.
fn translate(&self, path: &[String], translation: &JsonValue) -> Translation;
+
+ /// Whether the coordinator fixes the base when it commits instead of when it
+ /// proposes (no `baseHeads` then). Right for a kind whose content is the old
+ /// document at the base: the later the base, the fewer writes need carrying over,
+ /// and a write made after it is lost if its author restarts before switching.
+ fn base_at_commit(&self) -> bool {
+ false
+ }
}
/// The kind with this name.
@@ -97,6 +105,10 @@ impl RemakeKind for Compact {
"compact"
}
+ fn base_at_commit(&self) -> bool {
+ true
+ }
+
fn propose(&self, spec: &JsonValue) -> Result<Prepared, String> {
match spec {
JsonValue::Null => Ok(Prepared::default()),