You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/03/12 03:55:32 UTC
[4/7] mesos git commit: Replaced `const string` master constants with
`constexpr char[]`.
Replaced `const string` master constants with `constexpr char[]`.
Per style guide.
Review: https://reviews.apache.org/r/44718/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/14e96520
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/14e96520
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/14e96520
Branch: refs/heads/master
Commit: 14e9652025a66008e9f55b3583b477cefe124e9e
Parents: 83001de
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:15:54 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:21:34 2016 -0800
----------------------------------------------------------------------
src/master/constants.hpp | 16 +++++++---------
src/master/flags.cpp | 21 +++++++++++----------
src/tests/flags.hpp | 4 ++--
3 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/master/constants.hpp
----------------------------------------------------------------------
diff --git a/src/master/constants.hpp b/src/master/constants.hpp
index f87c2d5..a188da3 100644
--- a/src/master/constants.hpp
+++ b/src/master/constants.hpp
@@ -19,8 +19,6 @@
#include <stdint.h>
-#include <string>
-
#include <stout/bytes.hpp>
#include <stout/duration.hpp>
@@ -98,36 +96,36 @@ constexpr uint32_t TASK_LIMIT = 100;
*
* \deprecated Will be deprecated as of Mesos 0.24: see MESOS-2340.
*/
-const std::string MASTER_INFO_LABEL = "info";
+constexpr char MASTER_INFO_LABEL[] = "info";
/**
* Label used by the Leader Contender and Detector, for JSON content.
*
* \since Mesos 0.23 (see MESOS-2340).
*/
-const std::string MASTER_INFO_JSON_LABEL = "json.info";
+constexpr char MASTER_INFO_JSON_LABEL[] = "json.info";
// Timeout used for ZooKeeper related operations.
// TODO(vinod): Master detector/contender should use this timeout.
constexpr Duration ZOOKEEPER_SESSION_TIMEOUT = Seconds(10);
// Name of the default, CRAM-MD5 authenticator.
-const std::string DEFAULT_AUTHENTICATOR = "crammd5";
+constexpr char DEFAULT_AUTHENTICATOR[] = "crammd5";
// Name of the default, HierarchicalDRF authenticator.
-const std::string DEFAULT_ALLOCATOR = "HierarchicalDRF";
+constexpr char DEFAULT_ALLOCATOR[] = "HierarchicalDRF";
// The default interval between allocations.
constexpr Duration DEFAULT_ALLOCATION_INTERVAL = Seconds(1);
// Name of the default, local authorizer.
-const std::string DEFAULT_AUTHORIZER = "local";
+constexpr char DEFAULT_AUTHORIZER[] = "local";
// Name of the default, basic authenticator.
-const std::string DEFAULT_HTTP_AUTHENTICATOR = "basic";
+constexpr char DEFAULT_HTTP_AUTHENTICATOR[] = "basic";
// Name of the default, "mesos" HTTP authentication realm.
-const std::string DEFAULT_HTTP_AUTHENTICATION_REALM = "mesos";
+constexpr char DEFAULT_HTTP_AUTHENTICATION_REALM[] = "mesos";
} // namespace master {
} // namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index c1dd127..0d9c21f 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -22,6 +22,7 @@
#include "master/constants.hpp"
#include "master/flags.hpp"
+using std::string;
mesos::internal::master::Flags::Flags()
{
@@ -247,8 +248,8 @@ mesos::internal::master::Flags::Flags()
"or `/path/to/file`.\n"
"\n"
"Note that if the flag `--authorizers` is provided with a value\n"
- "different than `" + DEFAULT_AUTHORIZER + "`, the ACLs contents will be\n"
- "ignored.\n"
+ "different than `" + string(DEFAULT_AUTHORIZER) + "`, the ACLs contents\n"
+ "will be ignored.\n"
"\n"
"See the ACLs protobuf in authorizer.proto for the expected format.\n"
"\n"
@@ -397,14 +398,14 @@ mesos::internal::master::Flags::Flags()
add(&Flags::authenticators,
"authenticators",
"Authenticator implementation to use when authenticating frameworks\n"
- "and/or slaves. Use the default `" + DEFAULT_AUTHENTICATOR + "`, or\n"
- "load an alternate authenticator module using `--modules`.",
+ "and/or slaves. Use the default `" + string(DEFAULT_AUTHENTICATOR) + "`\n"
+ "or load an alternate authenticator module using `--modules`.",
DEFAULT_AUTHENTICATOR);
add(&Flags::allocator,
"allocator",
"Allocator to use for resource allocation to frameworks.\n"
- "Use the default `" + DEFAULT_ALLOCATOR + "` allocator, or\n"
+ "Use the default `" + string(DEFAULT_ALLOCATOR) + "` allocator, or\n"
"load an alternate allocator module using `--modules`.",
DEFAULT_ALLOCATOR);
@@ -448,12 +449,12 @@ mesos::internal::master::Flags::Flags()
"authorizers",
"Authorizer implementation to use when authorizing actions that\n"
"require it.\n"
- "Use the default `" + DEFAULT_AUTHORIZER + "`, or\n"
+ "Use the default `" + string(DEFAULT_AUTHORIZER) + "`, or\n"
"load an alternate authorizer module using `--modules`.\n"
"\n"
"Note that if the flag `--authorizers` is provided with a value\n"
- "different than the default `" + DEFAULT_AUTHORIZER + "`, the ACLs\n"
- "passed through the `--acls` flag will be ignored.\n"
+ "different than the default `" + string(DEFAULT_AUTHORIZER) + "`, the\n"
+ "ACLs passed through the `--acls` flag will be ignored.\n"
"\n"
"Currently there's no support for multiple authorizers.",
DEFAULT_AUTHORIZER);
@@ -462,8 +463,8 @@ mesos::internal::master::Flags::Flags()
"http_authenticators",
"HTTP authenticator implementation to use when handling requests to\n"
"authenticated endpoints. Use the default\n"
- "`" + DEFAULT_HTTP_AUTHENTICATOR + "`, or load an alternate HTTP\n"
- "authenticator module using `--modules`.\n"
+ "`" + string(DEFAULT_HTTP_AUTHENTICATOR) + "`, or load an alternate\n"
+ "HTTP authenticator module using `--modules`.\n"
"\n"
"Currently there is no support for multiple HTTP authenticators.",
DEFAULT_HTTP_AUTHENTICATOR);
http://git-wip-us.apache.org/repos/asf/mesos/blob/14e96520/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index 542f462..af15360 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -145,8 +145,8 @@ public:
add(&Flags::authenticators,
"authenticators",
"Authenticator implementation to use when authenticating frameworks\n"
- "and/or slaves. "
- "Use the default '" + master::DEFAULT_AUTHENTICATOR + "', or\n"
+ "and/or slaves. Use the default '" +
+ std::string(master::DEFAULT_AUTHENTICATOR) + "', or\n"
"load an alternate authenticator module using --modules.",
master::DEFAULT_AUTHENTICATOR);
}