From b89b7b7f8e6408d6eb1fd36037b9e6106333c243 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 9 May 2024 16:59:19 -0700 Subject: [PATCH] Require non-adjacent mutations This should make it so that mutations can only be adjacent if they're at different versions --- include/VersionedMap.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/VersionedMap.h b/include/VersionedMap.h index 41f03d4..0f2ad8d 100644 --- a/include/VersionedMap.h +++ b/include/VersionedMap.h @@ -66,7 +66,7 @@ struct VersionedMap { MutationType type; }; - /** Mutations must be sorted and non-overlapping. `version` + /** Mutations must be sorted, non-overlapping, and non-adjacent. `version` * must be strictly increasing. Postcondition: `getVersion()` == `version` */ void addMutations(const Mutation *mutations, int numMutations, int64_t version); @@ -86,14 +86,15 @@ struct VersionedMap { /** The version of the most recent call to `setOldestVersion`. */ int64_t getOldestVersion() const; - /** Iterates through a partially canonicalized[1] view of all the mutations + /** Iterates through a canonicalized[1] view of all the mutations * from `oldestVersion` to the iterator's version. There may be mutations from * versions < `oldestVersion`, but they won't affect the result. It's * thread-safe to operate on an iterator concurrently with any method of * `VersionedMap`, as long as it's not invalidated by `setOldestVersion`. * @warning must not outlive its `VersionedMap`. * - * [1]: Mutations are sorted and non-overlapping, but may be adjacent. + * [1]: Mutations at different versions may be adjacent. This is necessary for + * precisely tracking at what version the mutations take effect. */ struct Iterator {