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:35 UTC

[7/7] mesos git commit: Avoided external linkage for sched constants.

Avoided external linkage for sched constants.

We were only using external linkage to workaround bugs in ancient
(4.1.x) of GCC. We can also mark most of these constants `constexpr`
to bring this up-to-date with the latest style guidelines.

Review: https://reviews.apache.org/r/44721/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/da45261f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/da45261f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/da45261f

Branch: refs/heads/master
Commit: da45261f5a339c9376785f7e44c4d88a193b1a17
Parents: 716b47f
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Mar 11 18:31:44 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Mar 11 18:32:53 2016 -0800

----------------------------------------------------------------------
 src/CMakeLists.txt      |  1 -
 src/Makefile.am         |  1 -
 src/sched/constants.cpp | 36 ------------------------------------
 src/sched/constants.hpp | 13 ++++++++++---
 src/sched/flags.hpp     |  4 ++--
 5 files changed, 12 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a41d3cc..0517dd1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -223,7 +223,6 @@ set(MODULE_SRC
   )
 
 set(SCHED_SRC
-  sched/constants.cpp
   sched/sched.cpp
   )
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 5157b15..f2a592d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -641,7 +641,6 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   master/allocator/sorter/drf/sorter.cpp				\
   messages/messages.cpp							\
   module/manager.cpp							\
-  sched/constants.cpp							\
   sched/sched.cpp							\
   scheduler/scheduler.cpp						\
   slave/constants.cpp							\

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/constants.cpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.cpp b/src/sched/constants.cpp
deleted file mode 100644
index c00b8ba..0000000
--- a/src/sched/constants.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "sched/constants.hpp"
-
-namespace mesos {
-namespace internal {
-namespace scheduler {
-
-// NOTE: The default backoff factor for the scheduler (2s) is
-// different from the slave (1s) because the scheduler driver doesn't
-// do an initial backoff for the very first attempt unlike the slave.
-// TODO(vinod): Once we fix the scheduler driver to do initial backoff
-// we can change the default to 1s.
-const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(2);
-
-const Duration REGISTRATION_RETRY_INTERVAL_MAX = Minutes(1);
-
-const std::string DEFAULT_AUTHENTICATEE = "crammd5";
-
-} // namespace scheduler {
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/constants.hpp
----------------------------------------------------------------------
diff --git a/src/sched/constants.hpp b/src/sched/constants.hpp
index 523c6d9..df8a1cc 100644
--- a/src/sched/constants.hpp
+++ b/src/sched/constants.hpp
@@ -25,14 +25,21 @@ namespace scheduler {
 
 // Default backoff interval used by the scheduler driver to wait
 // before registration.
-extern const Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR;
+//
+// NOTE: The default backoff factor for the scheduler (2s) is
+// different from the slave (1s) because the scheduler driver doesn't
+// do an initial backoff for the very first attempt unlike the slave.
+//
+// TODO(vinod): Once we fix the scheduler driver to do initial backoff
+// we can change the default to 1s.
+constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR = Seconds(2);
 
 // The maximum interval the scheduler driver waits before retrying
 // registration.
-extern const Duration REGISTRATION_RETRY_INTERVAL_MAX;
+constexpr Duration REGISTRATION_RETRY_INTERVAL_MAX = Minutes(1);
 
 // Name of the default, CRAM-MD5 authenticatee.
-extern const std::string DEFAULT_AUTHENTICATEE;
+constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
 
 } // namespace scheduler {
 } // namespace internal {

http://git-wip-us.apache.org/repos/asf/mesos/blob/da45261f/src/sched/flags.hpp
----------------------------------------------------------------------
diff --git a/src/sched/flags.hpp b/src/sched/flags.hpp
index 57dbab8..b4ca12b 100644
--- a/src/sched/flags.hpp
+++ b/src/sched/flags.hpp
@@ -96,8 +96,8 @@ public:
     add(&Flags::authenticatee,
         "authenticatee",
         "Authenticatee implementation to use when authenticating against the\n"
-        "master. Use the default '" + DEFAULT_AUTHENTICATEE + "', or\n"
-        "load an alternate authenticatee module using MESOS_MODULES.",
+        "master. Use the default '" + std::string(DEFAULT_AUTHENTICATEE) + "'\n"
+        "or load an alternate authenticatee module using MESOS_MODULES.",
         DEFAULT_AUTHENTICATEE);
   }