diff --git a/bindings/c/fdb_c.cpp b/bindings/c/fdb_c.cpp index efb498b971..e4f44e8ae4 100644 --- a/bindings/c/fdb_c.cpp +++ b/bindings/c/fdb_c.cpp @@ -584,6 +584,11 @@ fdb_error_t fdb_transaction_get_committed_version( FDBTransaction* tr, *out_version = TXN(tr)->getCommittedVersion(); ); } +extern "C" DLLEXPORT +fdb_error_t fdb_transaction_get_approximate_size(FDBTransaction* tr, uint32_t* out_size) { + CATCH_AND_RETURN(*out_size = TXN(tr)->getApproximateSize();); +} + extern "C" DLLEXPORT FDBFuture* fdb_transaction_get_versionstamp( FDBTransaction* tr ) { diff --git a/bindings/c/foundationdb/fdb_c.h b/bindings/c/foundationdb/fdb_c.h index fd04c84592..b302d1a6ff 100644 --- a/bindings/c/foundationdb/fdb_c.h +++ b/bindings/c/foundationdb/fdb_c.h @@ -225,6 +225,9 @@ extern "C" { fdb_transaction_get_committed_version( FDBTransaction* tr, int64_t* out_version ); + DLLEXPORT WARN_UNUSED_RESULT fdb_error_t + fdb_transaction_get_approximate_size(FDBTransaction* tr, uint32_t* out_size); + DLLEXPORT WARN_UNUSED_RESULT FDBFuture* fdb_transaction_get_versionstamp( FDBTransaction* tr ); DLLEXPORT WARN_UNUSED_RESULT FDBFuture* diff --git a/bindings/flow/fdb_flow.actor.cpp b/bindings/flow/fdb_flow.actor.cpp index 99af1a665e..0dbb9e2444 100644 --- a/bindings/flow/fdb_flow.actor.cpp +++ b/bindings/flow/fdb_flow.actor.cpp @@ -20,12 +20,13 @@ #include "fdb_flow.h" -#include "flow/DeterministicRandom.h" -#include "flow/SystemMonitor.h" - #include #include +#include "flow/DeterministicRandom.h" +#include "flow/SystemMonitor.h" +#include "flow/actorcompiler.h" // This must be the last #include. + using namespace FDB; THREAD_FUNC networkThread(void* fdb) { @@ -147,6 +148,7 @@ namespace FDB { void setOption(FDBTransactionOption option, Optional value = Optional()) override; + uint32_t getApproximateSize() override; Future onError(Error const& e) override; void cancel() override; @@ -408,6 +410,12 @@ namespace FDB { } } + uint32_t TransactionImpl::getApproximateSize() { + uint32_t size; + throw_on_error(fdb_transaction_get_approximate_size(tr, &size)); + return size; + } + Future TransactionImpl::onError(Error const& e) { return backToFuture< Void >( fdb_transaction_on_error( tr, e.code() ), [](Reference f) { throw_on_error( fdb_future_get_error( f->f ) ); @@ -422,4 +430,5 @@ namespace FDB { void TransactionImpl::reset() { fdb_transaction_reset( tr ); } -} + +} // namespace FDB diff --git a/bindings/flow/fdb_flow.h b/bindings/flow/fdb_flow.h index 3e84daecad..6c088c5018 100644 --- a/bindings/flow/fdb_flow.h +++ b/bindings/flow/fdb_flow.h @@ -112,6 +112,7 @@ namespace FDB { virtual Future commit() = 0; virtual Version getCommittedVersion() = 0; + virtual uint32_t getApproximateSize() = 0; virtual Future> getVersionstamp() = 0; }; diff --git a/bindings/flow/tester/Tester.actor.cpp b/bindings/flow/tester/Tester.actor.cpp index fa309a59e8..865446e7bf 100644 --- a/bindings/flow/tester/Tester.actor.cpp +++ b/bindings/flow/tester/Tester.actor.cpp @@ -18,16 +18,17 @@ * limitations under the License. */ -#include "fdbrpc/fdbrpc.h" -#include "flow/DeterministicRandom.h" -#include "bindings/flow/Tuple.h" -#include "bindings/flow/FDBLoanerTypes.h" - #include "Tester.actor.h" #ifdef __linux__ #include #endif +#include "bindings/flow/Tuple.h" +#include "bindings/flow/FDBLoanerTypes.h" +#include "fdbrpc/fdbrpc.h" +#include "flow/DeterministicRandom.h" +#include "flow/actorcompiler.h" // This must be the last #include. + // Otherwise we have to type setupNetwork(), FDB::open(), etc. using namespace FDB; diff --git a/bindings/java/fdbJNI.cpp b/bindings/java/fdbJNI.cpp index 66191d9755..3e43d7b2dd 100644 --- a/bindings/java/fdbJNI.cpp +++ b/bindings/java/fdbJNI.cpp @@ -805,6 +805,21 @@ JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1 return (jlong)version; } +JNIEXPORT uint32_t JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getApproximateSize(JNIEnv *jenv, jobject, jlong tPtr) { + if( !tPtr ) { + throwParamNotNull(jenv); + return 0; + } + FDBTransaction *tr = (FDBTransaction *)tPtr; + uint32_t size; + fdb_error_t err = fdb_transaction_get_approximate_size(tr, &size); + if (err) { + safeThrow(jenv, getThrowable(jenv, err)); + return 0; + } + return size; +} + JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getVersionstamp(JNIEnv *jenv, jobject, jlong tPtr) { if (!tPtr) { throwParamNotNull(jenv); diff --git a/fdbclient/IClientApi.h b/fdbclient/IClientApi.h index e1d04e5a9f..db794fb6dd 100644 --- a/fdbclient/IClientApi.h +++ b/fdbclient/IClientApi.h @@ -61,6 +61,7 @@ public: virtual ThreadFuture commit() = 0; virtual Version getCommittedVersion() = 0; + virtual uint32_t getApproximateSize() = 0; virtual void setOption(FDBTransactionOptions::Option option, Optional value=Optional()) = 0; diff --git a/fdbclient/MultiVersionTransaction.actor.cpp b/fdbclient/MultiVersionTransaction.actor.cpp index 16bf8afd0a..ee633d8747 100644 --- a/fdbclient/MultiVersionTransaction.actor.cpp +++ b/fdbclient/MultiVersionTransaction.actor.cpp @@ -195,6 +195,12 @@ Version DLTransaction::getCommittedVersion() { return version; } +uint32_t DLTransaction::getApproximateSize() { + int32_t size; + throwIfError(api->transactionGetApproximateSize(tr, &size)); + return size; +} + void DLTransaction::setOption(FDBTransactionOptions::Option option, Optional value) { throwIfError(api->transactionSetOption(tr, option, value.present() ? value.get().begin() : NULL, value.present() ? value.get().size() : 0)); } @@ -287,6 +293,7 @@ void DLApi::init() { loadClientFunction(&api->transactionAtomicOp, lib, fdbCPath, "fdb_transaction_atomic_op"); loadClientFunction(&api->transactionCommit, lib, fdbCPath, "fdb_transaction_commit"); loadClientFunction(&api->transactionGetCommittedVersion, lib, fdbCPath, "fdb_transaction_get_committed_version"); + loadClientFunction(&api->transactionGetApproximateSize, lib, fdbCPath, "fdb_transaction_get_approximate_size"); loadClientFunction(&api->transactionWatch, lib, fdbCPath, "fdb_transaction_watch"); loadClientFunction(&api->transactionOnError, lib, fdbCPath, "fdb_transaction_on_error"); loadClientFunction(&api->transactionReset, lib, fdbCPath, "fdb_transaction_reset"); @@ -595,6 +602,14 @@ Version MultiVersionTransaction::getCommittedVersion() { return invalidVersion; } +uint32_t MultiVersionTransaction::getApproximateSize() { + auto tr = getTransaction(); + if (tr.transaction) { + return tr.transaction->getApproximateSize(); + } + return 0; +} + void MultiVersionTransaction::setOption(FDBTransactionOptions::Option option, Optional value) { if(MultiVersionApi::apiVersionAtLeast(610) && FDBTransactionOptions::optionInfo[option].persistent) { persistentOptions.emplace_back(option, value.castTo>()); diff --git a/fdbclient/MultiVersionTransaction.h b/fdbclient/MultiVersionTransaction.h index b1a1c3372a..86b4f72fb6 100644 --- a/fdbclient/MultiVersionTransaction.h +++ b/fdbclient/MultiVersionTransaction.h @@ -84,6 +84,7 @@ struct FdbCApi : public ThreadSafeReferenceCounted { FDBFuture* (*transactionCommit)(FDBTransaction *tr); fdb_error_t (*transactionGetCommittedVersion)(FDBTransaction *tr, int64_t *outVersion); + fdb_error_t (*transactionGetApproximateSize)(FDBTransaction *tr, int32_t *outSize); FDBFuture* (*transactionWatch)(FDBTransaction *tr, uint8_t const *keyName, int keyNameLength); FDBFuture* (*transactionOnError)(FDBTransaction *tr, fdb_error_t error); void (*transactionReset)(FDBTransaction *tr); @@ -116,41 +117,42 @@ public: DLTransaction(Reference api, FdbCApi::FDBTransaction *tr) : api(api), tr(tr) {} ~DLTransaction() { api->transactionDestroy(tr); } - void cancel(); - void setVersion(Version v); - ThreadFuture getReadVersion(); + void cancel() override; + void setVersion(Version v) override; + ThreadFuture getReadVersion() override; - ThreadFuture> get(const KeyRef& key, bool snapshot=false); - ThreadFuture getKey(const KeySelectorRef& key, bool snapshot=false); - ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange(const KeyRangeRef& keys, int limit, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false); - ThreadFuture>> getAddressesForKey(const KeyRef& key); - ThreadFuture> getVersionstamp(); + ThreadFuture> get(const KeyRef& key, bool snapshot=false) override; + ThreadFuture getKey(const KeySelectorRef& key, bool snapshot=false) override; + ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange(const KeyRangeRef& keys, int limit, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override; + ThreadFuture>> getAddressesForKey(const KeyRef& key) override; + ThreadFuture> getVersionstamp() override; - void addReadConflictRange(const KeyRangeRef& keys); + void addReadConflictRange(const KeyRangeRef& keys) override; - void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType); - void set(const KeyRef& key, const ValueRef& value); - void clear(const KeyRef& begin, const KeyRef& end); - void clear(const KeyRangeRef& range); - void clear(const KeyRef& key); + void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) override; + void set(const KeyRef& key, const ValueRef& value) override; + void clear(const KeyRef& begin, const KeyRef& end) override; + void clear(const KeyRangeRef& range) override; + void clear(const KeyRef& key) override; - ThreadFuture watch(const KeyRef& key); + ThreadFuture watch(const KeyRef& key) override; - void addWriteConflictRange(const KeyRangeRef& keys); + void addWriteConflictRange(const KeyRangeRef& keys) override; - ThreadFuture commit(); - Version getCommittedVersion(); + ThreadFuture commit() override; + Version getCommittedVersion() override; + uint32_t getApproximateSize() override; - void setOption(FDBTransactionOptions::Option option, Optional value=Optional()); + void setOption(FDBTransactionOptions::Option option, Optional value=Optional()) override; - ThreadFuture onError(Error const& e); - void reset(); + ThreadFuture onError(Error const& e) override; + void reset() override; - void addref() { ThreadSafeReferenceCounted::addref(); } - void delref() { ThreadSafeReferenceCounted::delref(); } + void addref() override { ThreadSafeReferenceCounted::addref(); } + void delref() override { ThreadSafeReferenceCounted::delref(); } private: const Reference api; @@ -165,11 +167,11 @@ public: ThreadFuture onReady(); - Reference createTransaction(); - void setOption(FDBDatabaseOptions::Option option, Optional value = Optional()); + Reference createTransaction() override; + void setOption(FDBDatabaseOptions::Option option, Optional value = Optional()) override; - void addref() { ThreadSafeReferenceCounted::addref(); } - void delref() { ThreadSafeReferenceCounted::delref(); } + void addref() override { ThreadSafeReferenceCounted::addref(); } + void delref() override { ThreadSafeReferenceCounted::delref(); } private: const Reference api; @@ -181,18 +183,18 @@ class DLApi : public IClientApi { public: DLApi(std::string fdbCPath); - void selectApiVersion(int apiVersion); - const char* getClientVersion(); + void selectApiVersion(int apiVersion) override; + const char* getClientVersion() override; - void setNetworkOption(FDBNetworkOptions::Option option, Optional value = Optional()); - void setupNetwork(); - void runNetwork(); - void stopNetwork(); + void setNetworkOption(FDBNetworkOptions::Option option, Optional value = Optional()) override; + void setupNetwork() override; + void runNetwork() override; + void stopNetwork() override; - Reference createDatabase(const char *clusterFilePath); + Reference createDatabase(const char *clusterFilePath) override; Reference createDatabase609(const char *clusterFilePath); // legacy database creation - void addNetworkThreadCompletionHook(void (*hook)(void*), void *hookParameter); + void addNetworkThreadCompletionHook(void (*hook)(void*), void *hookParameter) override; private: const std::string fdbCPath; @@ -212,41 +214,42 @@ class MultiVersionTransaction : public ITransaction, ThreadSafeReferenceCounted< public: MultiVersionTransaction(Reference db, UniqueOrderedOptionList defaultOptions); - void cancel(); - void setVersion(Version v); - ThreadFuture getReadVersion(); + void cancel() override; + void setVersion(Version v) override; + ThreadFuture getReadVersion() override; - ThreadFuture> get(const KeyRef& key, bool snapshot=false); - ThreadFuture getKey(const KeySelectorRef& key, bool snapshot=false); - ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange(const KeyRangeRef& keys, int limit, bool snapshot=false, bool reverse=false); - ThreadFuture> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false); - ThreadFuture>> getAddressesForKey(const KeyRef& key); - ThreadFuture> getVersionstamp(); + ThreadFuture> get(const KeyRef& key, bool snapshot=false) override; + ThreadFuture getKey(const KeySelectorRef& key, bool snapshot=false) override; + ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange(const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange(const KeyRangeRef& keys, int limit, bool snapshot=false, bool reverse=false) override; + ThreadFuture> getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot=false, bool reverse=false) override; + ThreadFuture>> getAddressesForKey(const KeyRef& key) override; + ThreadFuture> getVersionstamp() override; - void addReadConflictRange(const KeyRangeRef& keys); + void addReadConflictRange(const KeyRangeRef& keys) override; - void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType); - void set(const KeyRef& key, const ValueRef& value); - void clear(const KeyRef& begin, const KeyRef& end); - void clear(const KeyRangeRef& range); - void clear(const KeyRef& key); + void atomicOp(const KeyRef& key, const ValueRef& value, uint32_t operationType) override; + void set(const KeyRef& key, const ValueRef& value) override; + void clear(const KeyRef& begin, const KeyRef& end) override; + void clear(const KeyRangeRef& range) override; + void clear(const KeyRef& key) override; - ThreadFuture watch(const KeyRef& key); + ThreadFuture watch(const KeyRef& key) override; - void addWriteConflictRange(const KeyRangeRef& keys); + void addWriteConflictRange(const KeyRangeRef& keys) override; - ThreadFuture commit(); - Version getCommittedVersion(); + ThreadFuture commit() override; + Version getCommittedVersion() override; + uint32_t getApproximateSize() override; - void setOption(FDBTransactionOptions::Option option, Optional value=Optional()); + void setOption(FDBTransactionOptions::Option option, Optional value=Optional()) override; - ThreadFuture onError(Error const& e); - void reset(); + ThreadFuture onError(Error const& e) override; + void reset() override; - void addref() { ThreadSafeReferenceCounted::addref(); } - void delref() { ThreadSafeReferenceCounted::delref(); } + void addref() override { ThreadSafeReferenceCounted::addref(); } + void delref() override { ThreadSafeReferenceCounted::delref(); } private: const Reference db; @@ -289,11 +292,11 @@ public: MultiVersionDatabase(MultiVersionApi *api, std::string clusterFilePath, Reference db, bool openConnectors=true); ~MultiVersionDatabase(); - Reference createTransaction(); - void setOption(FDBDatabaseOptions::Option option, Optional value = Optional()); + Reference createTransaction() override; + void setOption(FDBDatabaseOptions::Option option, Optional value = Optional()) override; - void addref() { ThreadSafeReferenceCounted::addref(); } - void delref() { ThreadSafeReferenceCounted::delref(); } + void addref() override { ThreadSafeReferenceCounted::addref(); } + void delref() override { ThreadSafeReferenceCounted::delref(); } static Reference debugCreateFromExistingDatabase(Reference db); @@ -354,16 +357,16 @@ private: class MultiVersionApi : public IClientApi { public: - void selectApiVersion(int apiVersion); - const char* getClientVersion(); + void selectApiVersion(int apiVersion) override; + const char* getClientVersion() override; - void setNetworkOption(FDBNetworkOptions::Option option, Optional value = Optional()); - void setupNetwork(); - void runNetwork(); - void stopNetwork(); - void addNetworkThreadCompletionHook(void (*hook)(void*), void *hookParameter); + void setNetworkOption(FDBNetworkOptions::Option option, Optional value = Optional()) override; + void setupNetwork() override; + void runNetwork() override; + void stopNetwork() override; + void addNetworkThreadCompletionHook(void (*hook)(void*), void *hookParameter) override; - Reference createDatabase(const char *clusterFilePath); + Reference createDatabase(const char *clusterFilePath) override; static MultiVersionApi* api; Reference getLocalClient(); diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 1d44b5a3cc..19931005f8 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -3176,6 +3176,11 @@ Future> Transaction::getVersionstamp() { return versionstampPromise.getFuture(); } +uint32_t Transaction::getApproximateSize() { + return tr.transaction.mutations.expectedSize() + tr.transaction.read_conflict_ranges.expectedSize() + + tr.transaction.write_conflict_ranges.expectedSize(); +} + Future Transaction::onError( Error const& e ) { if (e.code() == error_code_success) { return client_invalid_operation(); diff --git a/fdbclient/NativeAPI.actor.h b/fdbclient/NativeAPI.actor.h index 218f1f09d9..3f07fd1e04 100644 --- a/fdbclient/NativeAPI.actor.h +++ b/fdbclient/NativeAPI.actor.h @@ -284,6 +284,7 @@ public: Promise> versionstampPromise; + uint32_t getApproximateSize(); Future onError( Error const& e ); void flushTrLogsIfEnabled(); diff --git a/fdbclient/ReadYourWrites.h b/fdbclient/ReadYourWrites.h index f4b93eabcc..1dd04445ea 100644 --- a/fdbclient/ReadYourWrites.h +++ b/fdbclient/ReadYourWrites.h @@ -98,6 +98,7 @@ public: Future commit(); Version getCommittedVersion() { return tr.getCommittedVersion(); } + uint32_t getApproximateSize() { return tr.getApproximateSize(); } Future> getVersionstamp(); void setOption( FDBTransactionOptions::Option option, Optional value = Optional() ); diff --git a/fdbclient/ThreadSafeTransaction.actor.cpp b/fdbclient/ThreadSafeTransaction.actor.cpp index 0a47c43407..35f69bc8b4 100644 --- a/fdbclient/ThreadSafeTransaction.actor.cpp +++ b/fdbclient/ThreadSafeTransaction.actor.cpp @@ -271,13 +271,15 @@ ThreadFuture< Void > ThreadSafeTransaction::commit() { Version ThreadSafeTransaction::getCommittedVersion() { // This should be thread safe when called legally, but it is fragile - Version v = tr->getCommittedVersion(); - return v; + return tr->getCommittedVersion(); +} + +uint32_t ThreadSafeTransaction::getApproximateSize() { + return tr->getApproximateSize(); } ThreadFuture> ThreadSafeTransaction::getVersionstamp() { - ReadYourWritesTransaction *tr = this->tr; - return onMainThread([tr]() -> Future < Standalone > { + return onMainThread([this]() -> Future < Standalone > { return tr->getVersionstamp(); }); } diff --git a/fdbclient/ThreadSafeTransaction.h b/fdbclient/ThreadSafeTransaction.h index 21c8de199a..2177b890e2 100644 --- a/fdbclient/ThreadSafeTransaction.h +++ b/fdbclient/ThreadSafeTransaction.h @@ -55,54 +55,54 @@ public: explicit ThreadSafeTransaction(DatabaseContext* cx); ~ThreadSafeTransaction(); - void cancel(); - void setVersion( Version v ); - ThreadFuture getReadVersion(); + void cancel() override; + void setVersion( Version v ) override; + ThreadFuture getReadVersion() override; - ThreadFuture< Optional > get( const KeyRef& key, bool snapshot = false ); - ThreadFuture< Key > getKey( const KeySelectorRef& key, bool snapshot = false ); - ThreadFuture< Standalone > getRange( const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot = false, bool reverse = false ); - ThreadFuture< Standalone > getRange( const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot = false, bool reverse = false ); - ThreadFuture< Standalone > getRange( const KeyRangeRef& keys, int limit, bool snapshot = false, bool reverse = false ) { - return getRange( firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limit, snapshot, reverse ); + ThreadFuture< Optional > get( const KeyRef& key, bool snapshot = false ) override; + ThreadFuture< Key > getKey( const KeySelectorRef& key, bool snapshot = false ) override; + ThreadFuture< Standalone > getRange( const KeySelectorRef& begin, const KeySelectorRef& end, int limit, bool snapshot = false, bool reverse = false ) override; + ThreadFuture< Standalone > getRange( const KeySelectorRef& begin, const KeySelectorRef& end, GetRangeLimits limits, bool snapshot = false, bool reverse = false ) override; + ThreadFuture< Standalone > getRange( const KeyRangeRef& keys, int limit, bool snapshot = false, bool reverse = false ) override { + return getRange( firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limit, snapshot, reverse ) override; } - ThreadFuture< Standalone > getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot = false, bool reverse = false ) { + ThreadFuture< Standalone > getRange( const KeyRangeRef& keys, GetRangeLimits limits, bool snapshot = false, bool reverse = false ) override { return getRange( firstGreaterOrEqual(keys.begin), firstGreaterOrEqual(keys.end), limits, snapshot, reverse ); } + ThreadFuture>> getAddressesForKey(const KeyRef& key) override; + ThreadFuture> getVersionstamp() override; - ThreadFuture>> getAddressesForKey(const KeyRef& key); - - void addReadConflictRange( const KeyRangeRef& keys ); + void addReadConflictRange( const KeyRangeRef& keys ) override; void makeSelfConflicting(); - void atomicOp( const KeyRef& key, const ValueRef& value, uint32_t operationType ); - void set( const KeyRef& key, const ValueRef& value ); - void clear( const KeyRef& begin, const KeyRef& end); - void clear( const KeyRangeRef& range ); - void clear( const KeyRef& key ); + void atomicOp( const KeyRef& key, const ValueRef& value, uint32_t operationType ) override; + void set( const KeyRef& key, const ValueRef& value ) override; + void clear( const KeyRef& begin, const KeyRef& end) override; + void clear( const KeyRangeRef& range ) override; + void clear( const KeyRef& key ) override; - ThreadFuture< Void > watch( const KeyRef& key ); + ThreadFuture< Void > watch( const KeyRef& key ) override; - void addWriteConflictRange( const KeyRangeRef& keys ); + void addWriteConflictRange( const KeyRangeRef& keys ) override; - ThreadFuture commit(); - Version getCommittedVersion(); - ThreadFuture> getVersionstamp(); + ThreadFuture commit() override; + Version getCommittedVersion() override; + uint32_t getApproximateSize() override; - void setOption( FDBTransactionOptions::Option option, Optional value = Optional() ); + void setOption( FDBTransactionOptions::Option option, Optional value = Optional() ) override; ThreadFuture checkDeferredError(); - ThreadFuture onError( Error const& e ); + ThreadFuture onError( Error const& e ) override; // These are to permit use as state variables in actors: ThreadSafeTransaction() : tr(NULL) {} void operator=(ThreadSafeTransaction&& r) BOOST_NOEXCEPT; ThreadSafeTransaction(ThreadSafeTransaction&& r) BOOST_NOEXCEPT; - void reset(); + void reset() override; - void addref() { ThreadSafeReferenceCounted::addref(); } - void delref() { ThreadSafeReferenceCounted::delref(); } + void addref() override { ThreadSafeReferenceCounted::addref(); } + void delref() override { ThreadSafeReferenceCounted::delref(); } private: ReadYourWritesTransaction *tr;