diff options
author | David Storch <david.storch@10gen.com> | 2015-03-12 19:23:39 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-03-27 18:29:57 -0400 |
commit | 617f0bd0803ecb2d40c138d363149dc8b46d6345 (patch) | |
tree | 593e6049b26622b09dda887671cbc08ad39899c9 /src/mongo/db/query/find.h | |
parent | 4e2bd6f18b2fc9b27465e098331562e0f06fc40d (diff) | |
download | mongo-617f0bd0803ecb2d40c138d363149dc8b46d6345.tar.gz |
SERVER-17283 initial getMore command implementation
Diffstat (limited to 'src/mongo/db/query/find.h')
-rw-r--r-- | src/mongo/db/query/find.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/mongo/db/query/find.h b/src/mongo/db/query/find.h index 3bc177f011f..f62b89f5c0a 100644 --- a/src/mongo/db/query/find.h +++ b/src/mongo/db/query/find.h @@ -40,6 +40,26 @@ namespace mongo { class OperationContext; + class ScopedRecoveryUnitSwapper { + public: + ScopedRecoveryUnitSwapper(ClientCursor* cc, OperationContext* txn); + + ~ScopedRecoveryUnitSwapper(); + + /** + * Dismissing the RU swapper causes it to simply free the recovery unit rather than swapping + * it back into the ClientCursor. + */ + void dismiss(); + + private: + ClientCursor* _cc; + OperationContext* _txn; + bool _dismissed; + + std::unique_ptr<RecoveryUnit> _txnPreviousRecoveryUnit; + }; + /** * Returns true if enough results have been prepared to stop adding more to the first batch. * @@ -48,6 +68,18 @@ namespace mongo { bool enoughForFirstBatch(const LiteParsedQuery& pq, int numDocs, int bytesBuffered); /** + * Returns true if enough results have been prepared to stop adding more to a getMore batch. + * + * Should be called *after* adding to the result set rather than before. + */ + bool enoughForGetMore(int ntoreturn, int numDocs, int bytesBuffered); + + /** + * Whether or not the ClientCursor* is tailable. + */ + bool isCursorTailable(const ClientCursor* cursor); + + /** * Returns true if we should keep a cursor around because we're expecting to return more query * results. * @@ -60,6 +92,17 @@ namespace mongo { PlanExecutor* exec); /** + * Similar to shouldSaveCursor(), but used in getMore to determine whether we should keep + * the cursor around for additional getMores(). + * + * If false, the caller should close the cursor and indicate this to the client by sending back + * a cursor ID of 0. + */ + bool shouldSaveCursorGetMore(PlanExecutor::ExecState finalState, + PlanExecutor* exec, + bool isTailable); + + /** * Fills out CurOp with information about this query. */ void beginQueryOp(const NamespaceString& nss, |