Interface change! addWrites now takes a single write version
All checks were successful
Tests / Release [gcc] total: 704, passed: 704
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap: Reference build: <a href="https://jenkins.weaselab.dev/job/weaselab/job/conflict-set/job/main/57//gcc">weaselab » conflict-set » main #57</a>
Tests / Release [gcc,aarch64] total: 703, passed: 703
Tests / Coverage total: 702, passed: 702
weaselab/conflict-set/pipeline/head This commit looks good

This commit is contained in:
2024-03-05 16:50:53 -08:00
parent ec3aec4dff
commit be5f1b67c8
10 changed files with 71 additions and 95 deletions

View File

@@ -44,22 +44,21 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
Key end;
int64_t readVersion;
};
/** Denotes a set of keys to be considered written at `writeVersion` */
/** Denotes a set of keys to be written at `writeVersion` */
struct WriteRange {
Key begin;
/** `end` having length 0 denotes that this range is the single key {begin}.
* Otherwise this denotes the range [begin, end) */
Key end;
/** Write version must be greater than all write versions in all previous
* calls to `addWrites` */
int64_t writeVersion;
};
/** The result of checking reads[i] is written in results[i]. */
void check(const ReadRange *reads, Result *results, int count) const;
/** `writes` must be sorted ascending, and must not have adjacent or
* overlapping ranges. Reads intersecting writes where readVersion <
* writeVersion will result in `Conflict` (or `TooOld`, eventually) */
void addWrites(const WriteRange *writes, int count);
* `writeVersion` will result in `Conflict` (or `TooOld`, eventually).
* `writeVersion must be greater than all write versions in all previous
* calls to `addWrites` */
void addWrites(const WriteRange *writes, int count, int64_t writeVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. Must be
* greater than any previous oldestVersion. */
void setOldestVersion(int64_t oldestVersion);
@@ -110,25 +109,25 @@ typedef struct {
ConflictSet_Key end;
int64_t readVersion;
} ConflictSet_ReadRange;
/** Denotes a set of keys to be considered written at `writeVersion` */
/** Denotes a set of keys to be written at `writeVersion` */
typedef struct {
ConflictSet_Key begin;
/** `end` having length 0 denotes that this range is the single key {begin}.
* Otherwise this denotes the range [begin, end) */
ConflictSet_Key end;
/** Write version must be greater than all write versions in all previous
* calls to `addWrites` */
int64_t writeVersion;
} ConflictSet_WriteRange;
/** The result of checking reads[i] is written in results[i]. */
void ConflictSet_check(ConflictSet *cs, const ConflictSet_ReadRange *reads,
ConflictSet_Result *results, int count);
/** `writes` must be sorted ascending, and must not have adjacent or overlapping
* ranges. Reads intersecting writes where readVersion < writeVersion will
* result in `Conflict` (or `TooOld`, eventually) */
/** `writes` must be sorted ascending, and must not have adjacent or
* overlapping ranges. Reads intersecting writes where readVersion <
* `writeVersion` will result in `Conflict` (or `TooOld`, eventually).
* `writeVersion must be greater than all write versions in all previous
* calls to `addWrites` */
void ConflictSet_addWrites(ConflictSet *cs,
const ConflictSet_WriteRange *writes, int count);
const ConflictSet_WriteRange *writes, int count,
int64_t writeVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. Must be
* greater than any previous oldestVersion. */
void ConflictSet_setOldestVersion(ConflictSet *cs, int64_t oldestVersion);