summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/record_store_test_harness.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/record_store_test_harness.h')
-rw-r--r--src/mongo/db/storage/record_store_test_harness.h33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/mongo/db/storage/record_store_test_harness.h b/src/mongo/db/storage/record_store_test_harness.h
index 09d028a97bd..e92a350003e 100644
--- a/src/mongo/db/storage/record_store_test_harness.h
+++ b/src/mongo/db/storage/record_store_test_harness.h
@@ -34,6 +34,7 @@
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/service_context_noop.h"
+#include "mongo/db/storage/test_harness_helper.h"
#include "mongo/stdx/memory.h"
namespace mongo {
@@ -41,47 +42,23 @@ namespace mongo {
class RecordStore;
class RecoveryUnit;
-class HarnessHelper {
+class RecordStoreHarnessHelper : public HarnessHelper {
public:
- HarnessHelper() : _serviceContext(), _client(_serviceContext.makeClient("hh")) {}
- virtual ~HarnessHelper() {}
-
virtual std::unique_ptr<RecordStore> newNonCappedRecordStore() = 0;
static const int64_t kDefaultCapedSizeBytes = 16 * 1024 * 1024;
virtual std::unique_ptr<RecordStore> newCappedRecordStore(
int64_t cappedSizeBytes = kDefaultCapedSizeBytes, int64_t cappedMaxDocs = -1) = 0;
- virtual ServiceContext::UniqueOperationContext newOperationContext(Client* client) {
- auto opCtx = client->makeOperationContext();
- opCtx->setRecoveryUnit(newRecoveryUnit(), OperationContext::kNotInUnitOfWork);
- return opCtx;
- }
-
- ServiceContext::UniqueOperationContext newOperationContext() {
- return newOperationContext(_client.get());
- }
-
/**
* Currently this requires that it is possible to have two independent open write operations
* at the same time one the same thread (with separate Clients, OperationContexts, and
* RecoveryUnits).
*/
virtual bool supportsDocLocking() = 0;
-
- Client* client() {
- return _client.get();
- }
- ServiceContext* serviceContext() {
- return &_serviceContext;
- }
-
-private:
- virtual RecoveryUnit* newRecoveryUnit() = 0;
-
- ServiceContextNoop _serviceContext;
- ServiceContext::UniqueClient _client;
};
-std::unique_ptr<HarnessHelper> newHarnessHelper();
+inline std::unique_ptr<RecordStoreHarnessHelper> newRecordStoreHarnessHelper() {
+ return dynamic_ptr_cast<RecordStoreHarnessHelper>(newHarnessHelper());
}
+} // namespace mongo