Remove has_read_version_been_set_ from CommitRequest

This commit is contained in:
2025-08-17 14:09:55 -04:00
parent fa2a2e4427
commit 67ddcd0fc8
4 changed files with 22 additions and 21 deletions

View File

@@ -3,7 +3,6 @@
#include "arena_allocator.hpp"
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>
@@ -43,7 +42,6 @@ private:
std::optional<std::string_view> request_id_;
std::string_view leader_id_;
uint64_t read_version_ = 0;
bool has_read_version_been_set_ = false;
std::vector<Precondition, ArenaStlAllocator<Precondition>> preconditions_;
std::vector<Operation, ArenaStlAllocator<Operation>> operations_;
@@ -59,7 +57,6 @@ public:
CommitRequest(CommitRequest &&other) noexcept
: arena_(std::move(other.arena_)), request_id_(other.request_id_),
leader_id_(other.leader_id_), read_version_(other.read_version_),
has_read_version_been_set_(other.has_read_version_been_set_),
preconditions_(std::move(other.preconditions_)),
operations_(std::move(other.operations_)) {}
@@ -70,7 +67,6 @@ public:
request_id_ = other.request_id_;
leader_id_ = other.leader_id_;
read_version_ = other.read_version_;
has_read_version_been_set_ = other.has_read_version_been_set_;
preconditions_ = std::move(other.preconditions_);
operations_ = std::move(other.operations_);
}
@@ -101,12 +97,6 @@ public:
*/
uint64_t read_version() const { return read_version_; }
/**
* @brief Check if read version has been explicitly set.
* @return true if read version was set during parsing
*/
bool has_read_version_been_set() const { return has_read_version_been_set_; }
/**
* @brief Get the preconditions.
* @return span of preconditions
@@ -151,7 +141,6 @@ public:
request_id_.reset();
leader_id_ = {};
read_version_ = 0;
has_read_version_been_set_ = false;
preconditions_.clear();
operations_.clear();
}
@@ -166,10 +155,7 @@ public:
leader_id_ = arena_allocated_leader_id;
}
void set_read_version(uint64_t read_version) {
read_version_ = read_version;
has_read_version_been_set_ = true;
}
void set_read_version(uint64_t read_version) { read_version_ = read_version; }
void add_precondition(Precondition::Type type, uint64_t version,
std::string_view arena_allocated_begin,
@@ -214,4 +200,4 @@ public:
}
}
}
};
};