Implement SimpleConfigTransaction::getCommittedVersion

This commit is contained in:
sfc-gh-tclinkenbeard 2021-04-30 09:43:18 -07:00
parent a3891a9246
commit 91f6f82cd8
1 changed files with 5 additions and 2 deletions

View File

@ -31,6 +31,7 @@ class SimpleConfigTransactionImpl {
ConfigTransactionInterface cti; ConfigTransactionInterface cti;
int numRetries{ 0 }; int numRetries{ 0 };
Error deferredError{ success() }; Error deferredError{ success() };
bool committed{ false };
ACTOR static Future<Version> getReadVersion(SimpleConfigTransactionImpl* self) { ACTOR static Future<Version> getReadVersion(SimpleConfigTransactionImpl* self) {
ConfigTransactionGetVersionRequest req; ConfigTransactionGetVersionRequest req;
@ -64,6 +65,7 @@ class SimpleConfigTransactionImpl {
} }
Version version = wait(self->version); Version version = wait(self->version);
wait(self->cti.commit.getReply(ConfigTransactionCommitRequest(version, self->mutations))); wait(self->cti.commit.getReply(ConfigTransactionCommitRequest(version, self->mutations)));
self->committed = true;
return Void(); return Void();
} }
@ -108,6 +110,8 @@ public:
return version; return version;
} }
Version getCommittedVersion() const { return committed ? version.get() : ::invalidVersion; }
void reset() { void reset() {
version = Future<Version>{}; version = Future<Version>{};
mutations = Standalone<VectorRef<MutationRef>>{}; mutations = Standalone<VectorRef<MutationRef>>{};
@ -209,8 +213,7 @@ Future<Void> SimpleConfigTransaction::commit() {
} }
Version SimpleConfigTransaction::getCommittedVersion() { Version SimpleConfigTransaction::getCommittedVersion() {
// TODO: Implement return impl->getCommittedVersion();
return ::invalidVersion;
} }
int64_t SimpleConfigTransaction::getApproximateSize() { int64_t SimpleConfigTransaction::getApproximateSize() {