summaryrefslogtreecommitdiff
path: root/src/mongo/base/status.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2012-09-10 10:35:08 -0400
committerAndy Schwerin <schwerin@10gen.com>2012-09-17 10:37:54 -0400
commitace5fac55b6ec2becf3758b8bdd4039438f23745 (patch)
tree9dbae6a6336d5f1d5525cf2128cbab9ede79a040 /src/mongo/base/status.h
parent3b738b913f169d816cc8ea7bdf6c4c3b51812ea7 (diff)
downloadmongo-ace5fac55b6ec2becf3758b8bdd4039438f23745.tar.gz
Implement and test InitializerDependencyGraph.
An InitializerDependencyGraph is a directed acyclic graph (DAG) of named initialization operations. Every node in the graph has a unique name, a behavior function, and a set of prerequisites. The graph supports two inspection functions, one to get the behavior function for a node with a given name, and the other to produce a vector of node names, ordered in a manner that does not violate any preprequisite dependneces. InitializerDependencyGraph is exception-free, and because it is for use very early in process startup, it does no logging itself. This patch also introduces a utility macro, MONGO_MAKE_STRING_VECTOR, which is useful for constructing std::vector<std::string> from a sequence of string literals. This patch uses it for testing, but subsequent MONGO_INIT-related work will rely on it, as well. Part of work on SERVER-5112.
Diffstat (limited to 'src/mongo/base/status.h')
-rw-r--r--src/mongo/base/status.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/base/status.h b/src/mongo/base/status.h
index 616055bbbf8..088dd5483ba 100644
--- a/src/mongo/base/status.h
+++ b/src/mongo/base/status.h
@@ -114,6 +114,14 @@ namespace mongo {
static void unref(ErrorInfo* error);
};
+ static inline bool operator==(const ErrorCodes::Error lhs, const Status& rhs) {
+ return rhs == lhs;
+ }
+
+ static inline bool operator!=(const ErrorCodes::Error lhs, const Status& rhs) {
+ return rhs != lhs;
+ }
+
//
// Convenience method for unittest code. Please use accessors otherwise.
//