From ba781b8875e1924f19cabb5bec1b7e4bcdb23939 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Sat, 10 Oct 2026 14:04:17 -0400 Subject: [PATCH] Spec that addWrites advances oldestVersion minimally The old wording only gave the lower bound oldestVersion >= newestVersion - two billion, which an implementation could satisfy by discarding more readable versions than necessary. State that oldestVersion becomes the larger of its previous value and newestVersion - two billion. --- include/ConflictSet.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/include/ConflictSet.h b/include/ConflictSet.h index aa929f1..c2c862c 100644 --- a/include/ConflictSet.h +++ b/include/ConflictSet.h @@ -84,11 +84,10 @@ struct __attribute__((__visibility__("default"))) ConflictSet { * `WriteRange` (see its field documentation); `count >= 0`; `writeVersion >= * newestVersion`. * @post Writes (writes[i], writeVersion) are recorded for every i < count, - * and `newestVersion` becomes `writeVersion`. `oldestVersion` advances as - * needed so that `oldestVersion >= newestVersion - two billion`; - * `oldestVersion <= newestVersion` is preserved. Calling with `count == 0` - * adds no write; `newestVersion` (and possibly `oldestVersion`) still - * advance. */ + * and `newestVersion` becomes `writeVersion`. `oldestVersion` advances only + * as far as necessary: it becomes the larger of its previous value and + * `newestVersion - two billion`. Calling with `count == 0` adds no write; + * `newestVersion` (and possibly `oldestVersion`) still advance. */ void addWrites(const WriteRange *writes, int count, int64_t writeVersion); /** Reads where readVersion < `oldestVersion` will result in `TooOld`. @@ -231,11 +230,10 @@ void ConflictSet_check(const ConflictSet *cs, * `ConflictSet_WriteRange` (see its field documentation); `count >= 0`; * `writeVersion >= newestVersion`. * @post Writes (writes[i], writeVersion) are recorded for every i < count, - * and `newestVersion` becomes `writeVersion`. `oldestVersion` advances as - * needed so that `oldestVersion >= newestVersion - two billion`; - * `oldestVersion <= newestVersion` is preserved. Calling with `count == 0` - * adds no write; `newestVersion` (and possibly `oldestVersion`) still - * advance. */ + * and `newestVersion` becomes `writeVersion`. `oldestVersion` advances only + * as far as necessary: it becomes the larger of its previous value and + * `newestVersion - two billion`. Calling with `count == 0` adds no write; + * `newestVersion` (and possibly `oldestVersion`) still advance. */ void ConflictSet_addWrites(ConflictSet *cs, const ConflictSet_WriteRange *writes, int count, int64_t writeVersion);