Storage Engine API
record_store_v1_simple_iterator.h
Go to the documentation of this file.
1 
29 #pragma once
30 
33 
34 namespace mongo {
35 
36 class SimpleRecordStoreV1;
37 
45 public:
46  SimpleRecordStoreV1Iterator(OperationContext* opCtx,
47  const SimpleRecordStoreV1* records,
48  bool forward);
49 
50  boost::optional<Record> next() final;
51  boost::optional<Record> seekExact(const RecordId& id) final;
52  void save() final;
53  bool restore() final;
55  _opCtx = nullptr;
56  }
57  void reattachToOperationContext(OperationContext* opCtx) final {
58  _opCtx = opCtx;
59  }
60  void invalidate(OperationContext* opCtx, const RecordId& dl) final;
61  std::unique_ptr<RecordFetcher> fetcherForNext() const final;
62  std::unique_ptr<RecordFetcher> fetcherForId(const RecordId& id) const final;
63 
64 private:
65  void advance();
66  bool isEOF() {
67  return _curr.isNull();
68  }
69 
70  // for getNext, not owned
71  OperationContext* _opCtx;
72 
73  // The result returned on the next call to getNext().
76  const bool _forward;
77 };
78 
79 } // namespace mongo
void save() final
Prepares for state changes in underlying data in a way that allows the cursor&#39;s current position to b...
Definition: record_store_v1_simple_iterator.cpp:115
const bool _forward
Definition: record_store_v1_simple_iterator.h:76
boost::optional< Record > next() final
Moves forward and returns the new data or boost::none if there is no more data.
Definition: record_store_v1_simple_iterator.cpp:79
DiskLoc _curr
Definition: record_store_v1_simple_iterator.h:74
bool isNull() const
Definition: diskloc.h:97
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
This class iterates over a non-capped collection identified by &#39;ns&#39;.
Definition: record_store_v1_simple_iterator.h:44
std::unique_ptr< RecordFetcher > fetcherForNext() const final
Returns a RecordFetcher if needed for a call to next() or none if unneeded.
Definition: record_store_v1_simple_iterator.cpp:122
void reattachToOperationContext(OperationContext *opCtx) final
Reattaches to the OperationContext and reacquires any storage-engine state.
Definition: record_store_v1_simple_iterator.h:57
Definition: record_store_v1_simple.h:42
represents a disk location/offset on disk in a database.
Definition: diskloc.h:53
std::unique_ptr< RecordFetcher > fetcherForId(const RecordId &id) const final
Returns a RecordFetcher if needed to fetch the provided Record or none if unneeded.
Definition: record_store_v1_simple_iterator.cpp:126
const SimpleRecordStoreV1 *const _recordStore
Definition: record_store_v1_simple_iterator.h:75
boost::optional< Record > seekExact(const RecordId &id) final
Seeks to a Record with the provided id.
Definition: record_store_v1_simple_iterator.cpp:87
Adds explicit seeking of records.
Definition: record_store.h:236
void advance()
Definition: record_store_v1_simple_iterator.cpp:93
SimpleRecordStoreV1Iterator(OperationContext *opCtx, const SimpleRecordStoreV1 *records, bool forward)
Definition: record_store_v1_simple_iterator.cpp:42
bool isEOF()
Definition: record_store_v1_simple_iterator.h:66
bool restore() final
Recovers from potential state changes in underlying data.
Definition: record_store_v1_simple_iterator.cpp:117
OperationContext * _opCtx
Definition: record_store_v1_simple_iterator.h:71
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
void invalidate(OperationContext *opCtx, const RecordId &dl) final
Inform the cursor that this id is being invalidated.
Definition: record_store_v1_simple_iterator.cpp:104
void detachFromOperationContext() final
Detaches from the OperationContext and releases any storage-engine state.
Definition: record_store_v1_simple_iterator.h:54