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.
This commit is contained in:
andrew committed 2026-10-10 14:04:17 -04:00
1 parent 8621662d3c
commit ba781b8875
1 file changed
+8 -10
+8 -10
View File
@@ -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);