summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/working_set_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/working_set_common.h')
-rw-r--r--src/mongo/db/exec/working_set_common.h198
1 files changed, 99 insertions, 99 deletions
diff --git a/src/mongo/db/exec/working_set_common.h b/src/mongo/db/exec/working_set_common.h
index aa1ecdb96c6..2fde57fda3a 100644
--- a/src/mongo/db/exec/working_set_common.h
+++ b/src/mongo/db/exec/working_set_common.h
@@ -33,104 +33,104 @@
namespace mongo {
- class CanonicalQuery;
- class Collection;
- class OperationContext;
- class RecordCursor;
-
- class WorkingSetCommon {
- public:
- /**
- * Get an owned copy of the BSONObj the WSM refers to.
- * Requires either a valid BSONObj or valid RecordId.
- * Returns true if the fetch and invalidate succeeded, false otherwise.
- */
- static bool fetchAndInvalidateLoc(OperationContext* txn,
- WorkingSetMember* member,
- const Collection* collection);
-
- /**
- * This must be called as part of "saveState" operations after all nodes in the tree save
- * their state.
- *
- * Iterates over 'workingSet' and converts all LOC_AND_UNOWNED_OBJ members to
- * LOC_AND_OWNED_OBJ by calling getOwned on their obj. Also sets the isSuspicious flag on
- * all nodes in LOC_AND_IDX state.
- */
- static void prepareForSnapshotChange(WorkingSet* workingSet);
-
- /**
- * Retrieves the document corresponding to 'member' from 'collection', and sets the state of
- * 'member' appropriately.
- *
- * If false is returned, the document should not be considered for the result set. It is the
- * caller's responsibility to free 'member' in this case.
- *
- * WriteConflict exceptions may be thrown. When they are, 'member' will be unmodified.
- */
- static bool fetch(OperationContext* txn,
- WorkingSetMember* member,
- unowned_ptr<RecordCursor> cursor);
-
- static bool fetchIfUnfetched(OperationContext* txn,
- WorkingSetMember* member,
- unowned_ptr<RecordCursor> cursor) {
- if (member->hasObj()) return true;
- return fetch(txn, member, cursor);
- }
-
- /**
- * Initialize the fields in 'dest' from 'src', creating copies of owned objects as needed.
- */
- static void initFrom(WorkingSetMember* dest, const WorkingSetMember& src);
-
- /**
- * Build a BSONObj which represents a Status to return in a WorkingSet.
- */
- static BSONObj buildMemberStatusObject(const Status& status);
-
- /**
- * Allocate a new WSM and initialize it with
- * the code and reason from the status.
- * Owned BSON object will have the following layout:
- * {
- * ok: <ok>, // 1 for OK; 0 otherwise.
- * code: <code>, // Status::code()
- * errmsg: <errmsg> // Status::reason()
- * }
- */
- static WorkingSetID allocateStatusMember(WorkingSet* ws, const Status& status);
-
- /**
- * Returns true if object was created by allocateStatusMember().
- */
- static bool isValidStatusMemberObject(const BSONObj& obj);
-
- /**
- * Returns object in working set member created with allocateStatusMember().
- * Does not assume isValidStatusMemberObject.
- * If the WSID is invalid or the working set member is created by
- * allocateStatusMember, objOut will not be updated.
- */
- static void getStatusMemberObject(const WorkingSet& ws, WorkingSetID wsid,
- BSONObj* objOut);
-
- /**
- * Returns status from working set member object.
- * Assumes isValidStatusMemberObject().
- */
- static Status getMemberObjectStatus(const BSONObj& memberObj);
-
- /**
- * Returns status from working set member created with allocateStatusMember().
- * Assumes isValidStatusMemberObject().
- */
- static Status getMemberStatus(const WorkingSetMember& member);
-
- /**
- * Formats working set member object created with allocateStatusMember().
- */
- static std::string toStatusString(const BSONObj& obj);
- };
+class CanonicalQuery;
+class Collection;
+class OperationContext;
+class RecordCursor;
+
+class WorkingSetCommon {
+public:
+ /**
+ * Get an owned copy of the BSONObj the WSM refers to.
+ * Requires either a valid BSONObj or valid RecordId.
+ * Returns true if the fetch and invalidate succeeded, false otherwise.
+ */
+ static bool fetchAndInvalidateLoc(OperationContext* txn,
+ WorkingSetMember* member,
+ const Collection* collection);
+
+ /**
+ * This must be called as part of "saveState" operations after all nodes in the tree save
+ * their state.
+ *
+ * Iterates over 'workingSet' and converts all LOC_AND_UNOWNED_OBJ members to
+ * LOC_AND_OWNED_OBJ by calling getOwned on their obj. Also sets the isSuspicious flag on
+ * all nodes in LOC_AND_IDX state.
+ */
+ static void prepareForSnapshotChange(WorkingSet* workingSet);
+
+ /**
+ * Retrieves the document corresponding to 'member' from 'collection', and sets the state of
+ * 'member' appropriately.
+ *
+ * If false is returned, the document should not be considered for the result set. It is the
+ * caller's responsibility to free 'member' in this case.
+ *
+ * WriteConflict exceptions may be thrown. When they are, 'member' will be unmodified.
+ */
+ static bool fetch(OperationContext* txn,
+ WorkingSetMember* member,
+ unowned_ptr<RecordCursor> cursor);
+
+ static bool fetchIfUnfetched(OperationContext* txn,
+ WorkingSetMember* member,
+ unowned_ptr<RecordCursor> cursor) {
+ if (member->hasObj())
+ return true;
+ return fetch(txn, member, cursor);
+ }
+
+ /**
+ * Initialize the fields in 'dest' from 'src', creating copies of owned objects as needed.
+ */
+ static void initFrom(WorkingSetMember* dest, const WorkingSetMember& src);
+
+ /**
+ * Build a BSONObj which represents a Status to return in a WorkingSet.
+ */
+ static BSONObj buildMemberStatusObject(const Status& status);
+
+ /**
+ * Allocate a new WSM and initialize it with
+ * the code and reason from the status.
+ * Owned BSON object will have the following layout:
+ * {
+ * ok: <ok>, // 1 for OK; 0 otherwise.
+ * code: <code>, // Status::code()
+ * errmsg: <errmsg> // Status::reason()
+ * }
+ */
+ static WorkingSetID allocateStatusMember(WorkingSet* ws, const Status& status);
+
+ /**
+ * Returns true if object was created by allocateStatusMember().
+ */
+ static bool isValidStatusMemberObject(const BSONObj& obj);
+
+ /**
+ * Returns object in working set member created with allocateStatusMember().
+ * Does not assume isValidStatusMemberObject.
+ * If the WSID is invalid or the working set member is created by
+ * allocateStatusMember, objOut will not be updated.
+ */
+ static void getStatusMemberObject(const WorkingSet& ws, WorkingSetID wsid, BSONObj* objOut);
+
+ /**
+ * Returns status from working set member object.
+ * Assumes isValidStatusMemberObject().
+ */
+ static Status getMemberObjectStatus(const BSONObj& memberObj);
+
+ /**
+ * Returns status from working set member created with allocateStatusMember().
+ * Assumes isValidStatusMemberObject().
+ */
+ static Status getMemberStatus(const WorkingSetMember& member);
+
+ /**
+ * Formats working set member object created with allocateStatusMember().
+ */
+ static std::string toStatusString(const BSONObj& obj);
+};
} // namespace mongo