summaryrefslogtreecommitdiff
path: root/s/grid.h
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-11-09 20:28:21 -0500
committerAlberto Lerner <alerner@10gen.com>2010-11-09 20:28:21 -0500
commit2bc8f5e0ade8476be7992194c3ed0899eb41572e (patch)
treeecd654b8e1f69edaadab677e0a937c2659d0c478 /s/grid.h
parent774bb188f63a00b9936d3334edd56cafb16ffb8d (diff)
downloadmongo-2bc8f5e0ade8476be7992194c3ed0899eb41572e.tar.gz
SERVER-2069 unittest for window of balancing
Diffstat (limited to 's/grid.h')
-rw-r--r--s/grid.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/s/grid.h b/s/grid.h
index bd96175c35d..fe8b04d3652 100644
--- a/s/grid.h
+++ b/s/grid.h
@@ -18,6 +18,8 @@
#pragma once
+#include <boost/date_time/posix_time/posix_time.hpp>
+
#include "../util/time_support.h"
#include "../util/concurrency/mutex.h"
@@ -82,6 +84,15 @@ namespace mongo {
unsigned long long getNextOpTime() const;
+ // exposed methods below are for testing only
+
+ /**
+ * @param balancerDoc bson that may contain a window of time for the balancer to work
+ * format { ... , activeWindow: { start: "8:30" , stop: "19:00" } , ... }
+ * @return true if there is no window of time specified for the balancer or it we're currently in it
+ */
+ static bool _inBalancingWindow( const BSONObj& balancerDoc , const boost::posix_time::ptime& now );
+
private:
mongo::mutex _lock; // protects _databases; TODO: change to r/w lock ??
map<string, DBConfigPtr > _databases; // maps ns to DBConfig's
@@ -104,14 +115,7 @@ namespace mongo {
* format { ... , stopped: [ "true" | "false" ] , ... }
* @return true if the marker is present and is set to true
*/
- bool _balancerStopped( const BSONObj& balancerDoc ) const;
-
- /**
- * @param balancerDoc bson that may contain a window of time for the balancer to work
- * format { ... , activeWindow: { start: "8:30" , stop: "19:00" } , ... }
- * @return true if there is no window of time specified for the balancer or it we're currently in it
- */
- bool _inBalancingWindow( const BSONObj& balancerDoc ) const;
+ static bool _balancerStopped( const BSONObj& balancerDoc );
};