C89, C++98 api smoke tests

This commit is contained in:
2024-01-18 20:42:59 -08:00
parent 0f9a86d775
commit 5d17675ad1
4 changed files with 79 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
Conflict,
/// The result of a check with a readVersion older than the highest call to
/// `setOldestVersion`
TooOld,
TooOld
};
/// Bytes ordered lexicographically
struct Key {
@@ -57,10 +57,12 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
explicit ConflictSet(int64_t oldestVersion);
~ConflictSet();
#if __cplusplus > 199711L
ConflictSet(ConflictSet &&) noexcept;
ConflictSet &operator=(ConflictSet &&) noexcept;
ConflictSet(const ConflictSet &) = delete;
ConflictSet &operator=(const ConflictSet &) = delete;
#endif
/// @private
struct Impl;
@@ -75,7 +77,7 @@ private:
typedef struct ConflictSet ConflictSet;
enum ConflictSet_Result {
typedef enum {
/// The result of a check which does not intersect any conflicting writes
ConflictSet_Commit,
/// The result of a check which intersects a write at a version >
@@ -83,23 +85,23 @@ enum ConflictSet_Result {
ConflictSet_Conflict,
/// The result of a check with a readVersion older than the highest call to
/// `setOldestVersion`
ConflictSet_TooOld,
};
ConflictSet_TooOld
} ConflictSet_Result;
/// Bytes ordered lexicographically
struct ConflictSet_Key {
typedef struct {
const uint8_t *p;
int len;
};
} ConflictSet_Key;
/// Denotes a set of keys to be checked for conflicts
struct ConflictSet_ReadRange {
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;
int64_t readVersion;
};
} ConflictSet_ReadRange;
/// Denotes a set of keys to be considered written at `writeVersion`
struct ConflictSet_WriteRange {
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)
@@ -107,7 +109,7 @@ struct ConflictSet_WriteRange {
/// Write version must be greater than all write versions in all previous
/// calls to `addWrites`
int64_t writeVersion;
};
} ConflictSet_WriteRange;
/// `reads` must be sorted ascending, and must not have adjacent or
/// overlapping ranges. The result of checking reads[i] is written in
@@ -127,4 +129,4 @@ void ConflictSet_setOldestVersion(ConflictSet *cs, int64_t oldestVersion);
ConflictSet *ConflictSet_create(int64_t oldestVersion);
void ConflictSet_destroy(ConflictSet *cs);
#endif
#endif