summaryrefslogtreecommitdiff
path: root/src/mongo/db/field_ref_set.h
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2013-11-07 12:42:20 -0500
committerScott Hernandez <scotthernandez@gmail.com>2013-11-13 19:30:18 -0500
commitb98712c551e8ab27c33e1a5e7c694fa36c3334ce (patch)
treef4d54911a8fb171ff1275896a1d733eac657e2fb /src/mongo/db/field_ref_set.h
parenta87e0ed4ec30725e3ffd7de75c0f204ca0f42b45 (diff)
downloadmongo-b98712c551e8ab27c33e1a5e7c694fa36c3334ce.tar.gz
SERVER-11531, SERVER-10489, SERVER-6835, SERVER-4830: Refactor update system to support immutable fields, consolodate storage validation, and misc issues.
Diffstat (limited to 'src/mongo/db/field_ref_set.h')
-rw-r--r--src/mongo/db/field_ref_set.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mongo/db/field_ref_set.h b/src/mongo/db/field_ref_set.h
index c80e3714e69..71a48502739 100644
--- a/src/mongo/db/field_ref_set.h
+++ b/src/mongo/db/field_ref_set.h
@@ -31,6 +31,8 @@
#include <set>
#include "mongo/base/disallow_copying.h"
+#include "mongo/base/owned_pointer_vector.h"
+#include "mongo/base/status.h"
#include "mongo/db/field_ref.h"
namespace mongo {
@@ -70,7 +72,7 @@ namespace mongo {
/**
* Returns true if the field 'toInsert' can be added in the set without
- * conflicts. Otwerwise returns false and fill in '*conflict' with the field 'toInsert'
+ * conflicts. Otherwise returns false and fill in '*conflict' with the field 'toInsert'
* clashed with.
*
* There is no ownership transfer of 'toInsert'. The caller is responsible for
@@ -80,6 +82,16 @@ namespace mongo {
bool insert(const FieldRef* toInsert, const FieldRef** conflict);
/**
+ * Fills the set with the supplied FieldRef*s
+ */
+ void fillFrom(const std::vector<FieldRef*>& fields);
+
+ /**
+ * Replace any existing conflicting FieldRef with the shortest (closest to root) one
+ */
+ void keepShortest(const FieldRef* toInsert);
+
+ /**
* Find all inserted fields which conflict with the FieldRef 'toCheck' by the semantics
* of 'insert', and add those fields to the 'conflicts' set.
*/
@@ -89,6 +101,11 @@ namespace mongo {
_fieldSet.clear();
}
+ /**
+ * A debug/log-able string
+ */
+ const std::string toString() const;
+
private:
// A set of field_ref pointers, none of which is owned here.
FieldSet _fieldSet;