Storage Engine API
record_store_test_updaterecord.h
Go to the documentation of this file.
1 // record_store_test_updaterecord.h
2 
31 #pragma once
32 
33 #include "mongo/db/record_id.h"
36 #include "mongo/unittest/unittest.h"
37 
38 namespace mongo {
39 namespace {
40 
41 class UpdateNotifierSpy : public UpdateNotifier {
42 public:
43  UpdateNotifierSpy(OperationContext* opCtx, const RecordId& loc, const char* buf, size_t size)
44  : _opCtx(opCtx), _loc(loc), _data(buf, size), nInPlaceCalls(0) {}
45 
46  ~UpdateNotifierSpy() {}
47 
48  Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx, const RecordId& loc) {
49  nInPlaceCalls++;
50  ASSERT_EQUALS(_opCtx, opCtx);
51  ASSERT_EQUALS(_loc, loc);
52  return Status::OK();
53  }
54 
55  int numInPlaceCallbacks() const {
56  return nInPlaceCalls;
57  }
58 
59 private:
60  OperationContext* _opCtx;
61  RecordId _loc;
62  std::string _data;
63 
64  // To verify the number of callbacks to the notifier.
66 };
67 
68 } // namespace
69 } // namespace mongo
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
OperationContext * _opCtx
Definition: record_store_test_updaterecord.h:60
std::string _data
Definition: record_store_test_updaterecord.h:62
int nInPlaceCalls
Definition: record_store_test_updaterecord.h:65
RecordId _loc
Definition: record_store_test_updaterecord.h:61
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80