diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-09-24 16:27:58 -0400 |
---|---|---|
committer | Ted Tuckman <ted.tuckman@mongodb.com> | 2018-10-04 11:22:05 -0400 |
commit | c589abf31b748d0f13e710d8d59394b65ab6891d (patch) | |
tree | 637288a6b560f8906bc0dd6ff3bf1b55eb709b79 /src/mongo/s/query/cluster_client_cursor_impl.cpp | |
parent | f9436146f64ad7caa2ce525c1d75a85f918d68c0 (diff) | |
download | mongo-c589abf31b748d0f13e710d8d59394b65ab6891d.tar.gz |
SERVER-37005 Add fields to GenericCursor
Diffstat (limited to 'src/mongo/s/query/cluster_client_cursor_impl.cpp')
-rw-r--r-- | src/mongo/s/query/cluster_client_cursor_impl.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mongo/s/query/cluster_client_cursor_impl.cpp b/src/mongo/s/query/cluster_client_cursor_impl.cpp index acda45f66f0..e58bbd1accc 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl.cpp +++ b/src/mongo/s/query/cluster_client_cursor_impl.cpp @@ -79,7 +79,9 @@ ClusterClientCursorImpl::ClusterClientCursorImpl(OperationContext* opCtx, : _params(std::move(params)), _root(buildMergerPlan(opCtx, executor, &_params)), _lsid(lsid), - _opCtx(opCtx) { + _opCtx(opCtx), + _createdDate(opCtx->getServiceContext()->getPreciseClockSource()->now()), + _lastUseDate(_createdDate) { dassert(!_params.compareWholeSortKey || SimpleBSONObjComparator::kInstance.evaluate( _params.sort == AsyncResultsMerger::kWholeSortKeySortPattern)); @@ -89,7 +91,12 @@ ClusterClientCursorImpl::ClusterClientCursorImpl(OperationContext* opCtx, std::unique_ptr<RouterExecStage> root, ClusterClientCursorParams&& params, boost::optional<LogicalSessionId> lsid) - : _params(std::move(params)), _root(std::move(root)), _lsid(lsid), _opCtx(opCtx) { + : _params(std::move(params)), + _root(std::move(root)), + _lsid(lsid), + _opCtx(opCtx), + _createdDate(opCtx->getServiceContext()->getPreciseClockSource()->now()), + _lastUseDate(_createdDate) { dassert(!_params.compareWholeSortKey || SimpleBSONObjComparator::kInstance.evaluate( _params.sort == AsyncResultsMerger::kWholeSortKeySortPattern)); @@ -181,6 +188,26 @@ boost::optional<TxnNumber> ClusterClientCursorImpl::getTxnNumber() const { return _params.txnNumber; } +Date_t ClusterClientCursorImpl::getCreatedDate() const { + return _createdDate; +} + +Date_t ClusterClientCursorImpl::getLastUseDate() const { + return _lastUseDate; +} + +void ClusterClientCursorImpl::setLastUseDate(Date_t now) { + _lastUseDate = std::move(now); +} + +std::uint64_t ClusterClientCursorImpl::getNBatches() const { + return _nBatchesReturned; +} + +void ClusterClientCursorImpl::incNBatches() { + ++_nBatchesReturned; +} + boost::optional<ReadPreferenceSetting> ClusterClientCursorImpl::getReadPreference() const { return _params.readPreference; } |