You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2015/02/10 19:22:35 UTC
[1/9] mesos git commit: Out of tree build 1: Moved Modules protobuf
to mesos/modules.proto.
Repository: mesos
Updated Branches:
refs/heads/master 4ed152304 -> c6361c556
Out of tree build 1: Moved Modules protobuf to mesos/modules.proto.
To expose Modules message outside the mesos source tree. This allows
modules to #include mesos/mesos.hpp and get the required protobuf
definition.
Review: https://reviews.apache.org/r/29598
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/16437353
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/16437353
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/16437353
Branch: refs/heads/master
Commit: 164373531eb8d7522f2deb25867aa95694d0ee10
Parents: 4ed1523
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:50:52 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:50:52 2015 -0800
----------------------------------------------------------------------
include/mesos/module/module.hpp | 25 +++++++++++++++
include/mesos/module/module.proto | 56 ++++++++++++++++++++++++++++++++++
src/Makefile.am | 28 +++++++++++++++--
src/common/parse.hpp | 2 ++
src/common/type_utils.hpp | 4 +++
src/master/flags.hpp | 4 +++
src/messages/messages.proto | 27 ----------------
src/module/manager.cpp | 2 ++
src/module/manager.hpp | 2 ++
src/slave/flags.hpp | 4 +++
src/tests/module.hpp | 2 ++
src/tests/module_tests.cpp | 2 ++
12 files changed, 129 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/include/mesos/module/module.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/module.hpp b/include/mesos/module/module.hpp
new file mode 100644
index 0000000..e83be28
--- /dev/null
+++ b/include/mesos/module/module.hpp
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_MODULE_MODULE_HPP__
+#define __MESOS_MODULE_MODULE_HPP__
+
+// ONLY USEFUL AFTER RUNNING PROTOC.
+#include <mesos/module/module.pb.h>
+
+#endif // __MESOS_MODULE_MODULE_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/include/mesos/module/module.proto
----------------------------------------------------------------------
diff --git a/include/mesos/module/module.proto b/include/mesos/module/module.proto
new file mode 100644
index 0000000..821fc0e
--- /dev/null
+++ b/include/mesos/module/module.proto
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import "mesos/mesos.proto";
+
+package mesos;
+
+option java_package = "org.apache.mesos";
+option java_outer_classname = "Protos";
+
+
+/**
+ * Collection of module libraries. A module library (Modules::Library) is a
+ * shared dynamic library (.so/.dylib) that contains one or more modules
+ * (Modules::Library::Module). Each module may have module-specific parameters
+ * in the form of key-value.
+ */
+message Modules {
+ message Library {
+ // If "file" contains a slash ("/"), then it is interpreted as a
+ // (relative or absolute) pathname. Otherwise a standard library
+ // search is performed.
+ optional string file = 1;
+
+ // We will add the proper prefix ("lib") and suffix (".so" for
+ // Linux and ".dylib" for OS X) to the "name".
+ optional string name = 2;
+
+ message Module {
+ // Module name.
+ optional string name = 1;
+
+ // Module-specific parameters.
+ repeated Parameter parameters = 2;
+ }
+
+ repeated Module modules = 3;
+ }
+
+ repeated Library libraries = 1;
+}
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 0fe4809..1790a60 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -137,6 +137,9 @@ CONTAINERIZER_PROTO = \
FETCHER_PROTO = \
$(top_srcdir)/include/mesos/fetcher/fetcher.proto
+MODULE_PROTO = \
+ $(top_srcdir)/include/mesos/module/module.proto
+
SCHEDULER_PROTO = \
$(top_srcdir)/include/mesos/scheduler/scheduler.proto
@@ -147,6 +150,8 @@ CXX_PROTOS = \
../include/mesos/containerizer/containerizer.pb.h \
fetcher/fetcher.pb.cc \
../include/mesos/fetcher/fetcher.pb.h \
+ module/module.pb.cc \
+ ../include/mesos/module/module.pb.h \
scheduler/scheduler.pb.cc \
../include/mesos/scheduler/scheduler.pb.h
@@ -201,6 +206,12 @@ fetcher/%.pb.cc ../include/mesos/fetcher/%.pb.h: $(FETCHER_PROTO)
$(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
mv ../include/mesos/fetcher/*.pb.cc $(@D)
+module/%.pb.cc ../include/mesos/module/%.pb.h: $(MODULE_PROTO)
+ $(MKDIR_P) $(@D)
+ $(MKDIR_P) ../include/mesos/module
+ $(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
+ mv ../include/mesos/module/*.pb.cc $(@D)
+
scheduler/%.pb.cc ../include/mesos/scheduler/%.pb.h: $(SCHEDULER_PROTO)
$(MKDIR_P) $(@D)
$(MKDIR_P) ../include/mesos/scheduler
@@ -342,7 +353,8 @@ pkginclude_HEADERS = \
nodist_pkginclude_HEADERS = \
../include/mesos/version.hpp \
- ../include/mesos/mesos.pb.h
+ ../include/mesos/mesos.pb.h \
+ ../include/mesos/module.pb.h
containerizerdir = $(pkgincludedir)/containerizer
@@ -360,6 +372,14 @@ fetcher_HEADERS = \
nodist_fetcher_HEADERS = ../include/mesos/fetcher/fetcher.pb.h
+moduledir = $(pkgincludedir)/module
+
+module_HEADERS = \
+ $(top_srcdir)/include/mesos/module/module.hpp \
+ $(top_srcdir)/include/mesos/module/module.proto
+
+nodist_module_HEADERS = ../include/mesos/module/module.pb.h
+
schedulerdir = $(pkgincludedir)/scheduler
scheduler_HEADERS = \
@@ -630,7 +650,11 @@ lib_LTLIBRARIES += libmesos.la
# Include as part of the distribution.
libmesos_la_SOURCES = \
- $(MESOS_PROTO) $(CONTAINERIZER_PROTO) $(FETCHER_PROTO) $(SCHEDULER_PROTO)
+ $(CONTAINERIZER_PROTO) \
+ $(FETCHER_PROTO) \
+ $(MESOS_PROTO) \
+ $(MODULE_PROTO) \
+ $(SCHEDULER_PROTO)
libmesos_la_LDFLAGS = -release $(PACKAGE_VERSION)
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/common/parse.hpp
----------------------------------------------------------------------
diff --git a/src/common/parse.hpp b/src/common/parse.hpp
index 772a1a5..547b320 100644
--- a/src/common/parse.hpp
+++ b/src/common/parse.hpp
@@ -16,6 +16,8 @@
#include <mesos/mesos.hpp>
+#include <mesos/module/module.hpp>
+
#include <stout/error.hpp>
#include <stout/json.hpp>
#include <stout/protobuf.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/common/type_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.hpp b/src/common/type_utils.hpp
index 5c24c08..6c68943 100644
--- a/src/common/type_utils.hpp
+++ b/src/common/type_utils.hpp
@@ -21,6 +21,10 @@
#include <boost/functional/hash.hpp>
+#include <mesos/mesos.hpp>
+
+#include <mesos/module/module.hpp>
+
#include <stout/uuid.hpp>
#include "common/attributes.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index df2e9cb..6cc0db6 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -21,6 +21,10 @@
#include <string>
+#include <mesos/mesos.hpp>
+
+#include <mesos/module/module.hpp>
+
#include <stout/duration.hpp>
#include <stout/flags.hpp>
#include <stout/json.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/messages/messages.proto
----------------------------------------------------------------------
diff --git a/src/messages/messages.proto b/src/messages/messages.proto
index 44122bd..70b0bdc 100644
--- a/src/messages/messages.proto
+++ b/src/messages/messages.proto
@@ -450,30 +450,3 @@ message TaskHealthStatus {
// This will not be populated if task is healthy.
optional int32 consecutive_failures = 4;
}
-
-
-// Collection of Modules.
-message Modules {
- message Library {
- // If "file" contains a slash ("/"), then it is interpreted as a
- // (relative or absolute) pathname. Otherwise a standard library
- // search is performed.
- optional string file = 1;
-
- // We will add the proper prefix ("lib") and suffix (".so" for
- // Linux and ".dylib" for OS X) to the "name".
- optional string name = 2;
-
- message Module {
- // Module name.
- optional string name = 1;
-
- // Module-specific parameters.
- repeated Parameter parameters = 2;
- }
-
- repeated Module modules = 3;
- }
-
- repeated Library libraries = 1;
-}
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/module/manager.cpp
----------------------------------------------------------------------
diff --git a/src/module/manager.cpp b/src/module/manager.cpp
index 573df82..44a3e65 100644
--- a/src/module/manager.cpp
+++ b/src/module/manager.cpp
@@ -21,6 +21,8 @@
#include <mesos/module.hpp>
+#include <mesos/module/module.hpp>
+
#include <stout/json.hpp>
#include <stout/numify.hpp>
#include <stout/os.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/module/manager.hpp
----------------------------------------------------------------------
diff --git a/src/module/manager.hpp b/src/module/manager.hpp
index 7a9d93b..f071678 100644
--- a/src/module/manager.hpp
+++ b/src/module/manager.hpp
@@ -30,6 +30,8 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
+#include <mesos/module/module.hpp>
+
#include <process/owned.hpp>
#include <stout/check.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index f603335..c4832bb 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -21,6 +21,10 @@
#include <string>
+#include <mesos/mesos.hpp>
+
+#include <mesos/module/module.hpp>
+
#include <stout/bytes.hpp>
#include <stout/duration.hpp>
#include <stout/flags.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/tests/module.hpp
----------------------------------------------------------------------
diff --git a/src/tests/module.hpp b/src/tests/module.hpp
index 776a426..5748add 100644
--- a/src/tests/module.hpp
+++ b/src/tests/module.hpp
@@ -21,6 +21,8 @@
#include <string>
+#include <mesos/module/module.hpp>
+
#include <stout/try.hpp>
#include "logging/flags.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/16437353/src/tests/module_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module_tests.cpp b/src/tests/module_tests.cpp
index 2e113be..c9d7381 100644
--- a/src/tests/module_tests.cpp
+++ b/src/tests/module_tests.cpp
@@ -18,6 +18,8 @@
#include <mesos/module.hpp>
+#include <mesos/module/module.hpp>
+
#include <stout/dynamiclibrary.hpp>
#include <stout/os.hpp>
[5/9] mesos git commit: Out of tree build 5: Exposed
slave/containerizer/isolator.hpp as mesos/slave/isolator.hpp
Posted by nn...@apache.org.
Out of tree build 5: Exposed slave/containerizer/isolator.hpp as mesos/slave/isolator.hpp
Expose "slave/state.hpp" and "slave/containerizer/isolator.hpp" to
allow modules to include them directly from the Mesos install
location.
Review: https://reviews.apache.org/r/29603
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0082eb6d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0082eb6d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0082eb6d
Branch: refs/heads/master
Commit: 0082eb6d1a4cb87b2fb3672524a02d04e02854f9
Parents: 79a18e6
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:54:37 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:54:37 2015 -0800
----------------------------------------------------------------------
include/mesos/slave/isolator.hpp | 163 +++++++++++++++++++
src/Makefile.am | 6 +-
src/examples/test_isolator_module.cpp | 3 +-
src/module/isolator.hpp | 2 +-
src/slave/containerizer/containerizer.cpp | 1 -
.../containerizer/external_containerizer.hpp | 1 -
src/slave/containerizer/isolator.cpp | 4 +-
src/slave/containerizer/isolator.hpp | 163 -------------------
.../isolators/cgroups/cpushare.hpp | 4 +-
.../containerizer/isolators/cgroups/mem.hpp | 4 +-
.../isolators/cgroups/perf_event.hpp | 4 +-
.../isolators/filesystem/shared.hpp | 4 +-
.../containerizer/isolators/namespaces/pid.hpp | 4 +-
.../isolators/network/port_mapping.hpp | 4 +-
src/slave/containerizer/isolators/posix.hpp | 4 +-
.../containerizer/isolators/posix/disk.hpp | 4 +-
src/slave/containerizer/launcher.hpp | 4 +-
src/slave/containerizer/mesos/containerizer.cpp | 3 +-
src/slave/containerizer/mesos/containerizer.hpp | 3 +-
src/tests/containerizer_tests.cpp | 7 +-
src/tests/isolator.hpp | 2 +-
src/tests/isolator_tests.cpp | 3 +-
src/tests/module_tests.cpp | 5 +-
src/tests/port_mapping_tests.cpp | 1 +
24 files changed, 206 insertions(+), 197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/include/mesos/slave/isolator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/slave/isolator.hpp b/include/mesos/slave/isolator.hpp
new file mode 100644
index 0000000..907be5b
--- /dev/null
+++ b/include/mesos/slave/isolator.hpp
@@ -0,0 +1,163 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_SLAVE_ISOLATOR_HPP__
+#define __MESOS_SLAVE_ISOLATOR_HPP__
+
+#include <list>
+#include <string>
+
+#include <mesos/resources.hpp>
+
+#include <process/dispatch.hpp>
+#include <process/future.hpp>
+#include <process/owned.hpp>
+#include <process/process.hpp>
+
+#include <stout/try.hpp>
+
+namespace mesos {
+namespace slave {
+
+// Forward declaration.
+class IsolatorProcess;
+
+// Information when an executor is impacted by a resource limitation
+// and should be terminated. Intended to support resources like memory
+// where the Linux kernel may invoke the OOM killer, killing some/all
+// of a container's processes.
+struct Limitation
+{
+ Limitation(
+ const Resources& _resources,
+ const std::string& _message)
+ : resources(_resources),
+ message(_message) {}
+
+ // Resources that triggered the limitation.
+ // NOTE: 'Resources' is used here because the resource may span
+ // multiple roles (e.g. `"mem(*):1;mem(role):2"`).
+ Resources resources;
+
+ // Description of the limitation.
+ std::string message;
+};
+
+
+// This struct is derived from slave::state::RunState. It contains
+// only those fields that are needed by Isolators for recovering the
+// containers. The reason for not using RunState instead is to avoid
+// any dependency on RunState and in turn on internal protobufs.
+struct ExecutorRunState
+{
+ ExecutorRunState(ContainerID id_, pid_t pid_, std::string directory_)
+ : id(id_), pid(pid_), directory(directory_) {}
+
+ ContainerID id; // Container id of the last executor run.
+ pid_t pid; // Executor pid.
+ std::string directory; // Executor work directory.
+};
+
+
+class Isolator
+{
+public:
+ explicit Isolator(process::Owned<IsolatorProcess> process);
+ ~Isolator();
+
+ // Recover containers from the run states.
+ process::Future<Nothing> recover(
+ const std::list<ExecutorRunState>& states);
+
+ // Prepare for isolation of the executor. Any steps that require execution in
+ // the containerized context (e.g. inside a network namespace) can be
+ // returned in the optional CommandInfo and they will be run by the Launcher.
+ // TODO(idownes): Any URIs or Environment in the CommandInfo will be ignored;
+ // only the command value is used.
+ process::Future<Option<CommandInfo> > prepare(
+ const ContainerID& containerId,
+ const ExecutorInfo& executorInfo,
+ const std::string& directory,
+ const Option<std::string>& user);
+
+ // Isolate the executor.
+ process::Future<Nothing> isolate(
+ const ContainerID& containerId,
+ pid_t pid);
+
+ // Watch the containerized executor and report if any resource constraint
+ // impacts the container, e.g., the kernel killing some processes.
+ process::Future<Limitation> watch(const ContainerID& containerId);
+
+ // Update the resources allocated to the container.
+ process::Future<Nothing> update(
+ const ContainerID& containerId,
+ const Resources& resources);
+
+ // Gather resource usage statistics for the container.
+ process::Future<ResourceStatistics> usage(
+ const ContainerID& containerId) const;
+
+ // Clean up a terminated container. This is called after the executor and all
+ // processes in the container have terminated.
+ process::Future<Nothing> cleanup(const ContainerID& containerId);
+
+private:
+ Isolator(const Isolator&); // Not copyable.
+ Isolator& operator=(const Isolator&); // Not assignable.
+
+ process::Owned<IsolatorProcess> process;
+};
+
+
+class IsolatorProcess : public process::Process<IsolatorProcess>
+{
+public:
+ virtual ~IsolatorProcess() {}
+
+ virtual process::Future<Nothing> recover(
+ const std::list<ExecutorRunState>& state) = 0;
+
+ virtual process::Future<Option<CommandInfo> > prepare(
+ const ContainerID& containerId,
+ const ExecutorInfo& executorInfo,
+ const std::string& directory,
+ const Option<std::string>& user) = 0;
+
+ virtual process::Future<Nothing> isolate(
+ const ContainerID& containerId,
+ pid_t pid) = 0;
+
+ virtual process::Future<Limitation> watch(
+ const ContainerID& containerId) = 0;
+
+ virtual process::Future<Nothing> update(
+ const ContainerID& containerId,
+ const Resources& resources) = 0;
+
+ virtual process::Future<ResourceStatistics> usage(
+ const ContainerID& containerId) = 0;
+
+ virtual process::Future<Nothing> cleanup(const ContainerID& containerId) = 0;
+};
+
+
+} // namespace slave {
+} // namespace mesos {
+
+#endif // __MESOS_SLAVE_ISOLATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e26f23..00fb2a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -389,6 +389,11 @@ scheduler_HEADERS = \
nodist_scheduler_HEADERS = ../include/mesos/scheduler/scheduler.pb.h
+slavedir = $(pkgincludedir)/slave
+
+slave_HEADERS = \
+ $(top_srcdir)/include/mesos/slave/isolator.hpp
+
if OS_LINUX
libmesos_no_3rdparty_la_SOURCES += linux/cgroups.cpp
libmesos_no_3rdparty_la_SOURCES += linux/fs.cpp
@@ -506,7 +511,6 @@ libmesos_no_3rdparty_la_SOURCES += \
slave/containerizer/containerizer.hpp \
slave/containerizer/fetcher.hpp \
slave/containerizer/external_containerizer.hpp \
- slave/containerizer/isolator.hpp \
slave/containerizer/launcher.hpp \
slave/containerizer/linux_launcher.hpp \
slave/containerizer/mesos/containerizer.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/examples/test_isolator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_isolator_module.cpp b/src/examples/test_isolator_module.cpp
index 3b92b04..dc804fe 100644
--- a/src/examples/test_isolator_module.cpp
+++ b/src/examples/test_isolator_module.cpp
@@ -19,11 +19,12 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
+#include <mesos/slave/isolator.hpp>
+
#include <stout/try.hpp>
#include "module/isolator.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/isolators/posix.hpp"
#include "slave/flags.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/module/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/module/isolator.hpp b/src/module/isolator.hpp
index b5c86e3..4457186 100644
--- a/src/module/isolator.hpp
+++ b/src/module/isolator.hpp
@@ -22,7 +22,7 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
-#include "slave/containerizer/isolator.hpp"
+#include <mesos/slave/isolator.hpp>
namespace mesos {
namespace modules {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.cpp b/src/slave/containerizer/containerizer.cpp
index cf2ece8..4e0dc3b 100644
--- a/src/slave/containerizer/containerizer.cpp
+++ b/src/slave/containerizer/containerizer.cpp
@@ -38,7 +38,6 @@
#include "slave/containerizer/composing.hpp"
#include "slave/containerizer/containerizer.hpp"
#include "slave/containerizer/docker.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
#include "slave/containerizer/external_containerizer.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/external_containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.hpp b/src/slave/containerizer/external_containerizer.hpp
index d7ae6d6..5035454 100644
--- a/src/slave/containerizer/external_containerizer.hpp
+++ b/src/slave/containerizer/external_containerizer.hpp
@@ -34,7 +34,6 @@
#include "slave/state.hpp"
#include "slave/containerizer/containerizer.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolator.cpp b/src/slave/containerizer/isolator.cpp
index 9f5ba99..ee294a2 100644
--- a/src/slave/containerizer/isolator.cpp
+++ b/src/slave/containerizer/isolator.cpp
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-#include <process/dispatch.hpp>
+#include <mesos/slave/isolator.hpp>
-#include "slave/containerizer/isolator.hpp"
+#include <process/dispatch.hpp>
using namespace process;
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolator.hpp b/src/slave/containerizer/isolator.hpp
deleted file mode 100644
index 0823f4a..0000000
--- a/src/slave/containerizer/isolator.hpp
+++ /dev/null
@@ -1,163 +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.
- */
-
-#ifndef __ISOLATOR_HPP__
-#define __ISOLATOR_HPP__
-
-#include <list>
-#include <string>
-
-#include <mesos/resources.hpp>
-
-#include <process/dispatch.hpp>
-#include <process/future.hpp>
-#include <process/owned.hpp>
-#include <process/process.hpp>
-
-#include <stout/try.hpp>
-
-namespace mesos {
-namespace slave {
-
-// Forward declaration.
-class IsolatorProcess;
-
-// Information when an executor is impacted by a resource limitation
-// and should be terminated. Intended to support resources like memory
-// where the Linux kernel may invoke the OOM killer, killing some/all
-// of a container's processes.
-struct Limitation
-{
- Limitation(
- const Resources& _resources,
- const std::string& _message)
- : resources(_resources),
- message(_message) {}
-
- // Resources that triggered the limitation.
- // NOTE: 'Resources' is used here because the resource may span
- // multiple roles (e.g. `"mem(*):1;mem(role):2"`).
- Resources resources;
-
- // Description of the limitation.
- std::string message;
-};
-
-
-// This struct is derived from slave::state::RunState. It contains
-// only those fields that are needed by Isolators for recovering the
-// containers. The reason for not using RunState instead is to avoid
-// any dependency on RunState and in turn on internal protobufs.
-struct ExecutorRunState
-{
- ExecutorRunState(ContainerID id_, pid_t pid_, std::string directory_)
- : id(id_), pid(pid_), directory(directory_) {}
-
- ContainerID id; // Container id of the last executor run.
- pid_t pid; // Executor pid.
- std::string directory; // Executor work directory.
-};
-
-
-class Isolator
-{
-public:
- explicit Isolator(process::Owned<IsolatorProcess> process);
- ~Isolator();
-
- // Recover containers from the run states.
- process::Future<Nothing> recover(
- const std::list<ExecutorRunState>& states);
-
- // Prepare for isolation of the executor. Any steps that require execution in
- // the containerized context (e.g. inside a network namespace) can be
- // returned in the optional CommandInfo and they will be run by the Launcher.
- // TODO(idownes): Any URIs or Environment in the CommandInfo will be ignored;
- // only the command value is used.
- process::Future<Option<CommandInfo> > prepare(
- const ContainerID& containerId,
- const ExecutorInfo& executorInfo,
- const std::string& directory,
- const Option<std::string>& user);
-
- // Isolate the executor.
- process::Future<Nothing> isolate(
- const ContainerID& containerId,
- pid_t pid);
-
- // Watch the containerized executor and report if any resource constraint
- // impacts the container, e.g., the kernel killing some processes.
- process::Future<Limitation> watch(const ContainerID& containerId);
-
- // Update the resources allocated to the container.
- process::Future<Nothing> update(
- const ContainerID& containerId,
- const Resources& resources);
-
- // Gather resource usage statistics for the container.
- process::Future<ResourceStatistics> usage(
- const ContainerID& containerId) const;
-
- // Clean up a terminated container. This is called after the executor and all
- // processes in the container have terminated.
- process::Future<Nothing> cleanup(const ContainerID& containerId);
-
-private:
- Isolator(const Isolator&); // Not copyable.
- Isolator& operator=(const Isolator&); // Not assignable.
-
- process::Owned<IsolatorProcess> process;
-};
-
-
-class IsolatorProcess : public process::Process<IsolatorProcess>
-{
-public:
- virtual ~IsolatorProcess() {}
-
- virtual process::Future<Nothing> recover(
- const std::list<ExecutorRunState>& state) = 0;
-
- virtual process::Future<Option<CommandInfo> > prepare(
- const ContainerID& containerId,
- const ExecutorInfo& executorInfo,
- const std::string& directory,
- const Option<std::string>& user) = 0;
-
- virtual process::Future<Nothing> isolate(
- const ContainerID& containerId,
- pid_t pid) = 0;
-
- virtual process::Future<Limitation> watch(
- const ContainerID& containerId) = 0;
-
- virtual process::Future<Nothing> update(
- const ContainerID& containerId,
- const Resources& resources) = 0;
-
- virtual process::Future<ResourceStatistics> usage(
- const ContainerID& containerId) = 0;
-
- virtual process::Future<Nothing> cleanup(const ContainerID& containerId) = 0;
-};
-
-
-} // namespace slave {
-} // namespace mesos {
-
-#endif // __ISOLATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/cgroups/cpushare.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/cpushare.hpp b/src/slave/containerizer/isolators/cgroups/cpushare.hpp
index 6c6c57d..f4ae149 100644
--- a/src/slave/containerizer/isolators/cgroups/cpushare.hpp
+++ b/src/slave/containerizer/isolators/cgroups/cpushare.hpp
@@ -21,12 +21,12 @@
#include <string>
+#include <mesos/slave/isolator.hpp>
+
#include <stout/hashmap.hpp>
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
#include "slave/containerizer/isolators/cgroups/constants.hpp"
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/cgroups/mem.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/mem.hpp b/src/slave/containerizer/isolators/cgroups/mem.hpp
index c3793c4..92f197b 100644
--- a/src/slave/containerizer/isolators/cgroups/mem.hpp
+++ b/src/slave/containerizer/isolators/cgroups/mem.hpp
@@ -19,12 +19,12 @@
#ifndef __MEM_ISOLATOR_HPP__
#define __MEM_ISOLATOR_HPP__
+#include <mesos/slave/isolator.hpp>
+
#include <stout/hashmap.hpp>
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
#include "slave/containerizer/isolators/cgroups/constants.hpp"
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/cgroups/perf_event.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/perf_event.hpp b/src/slave/containerizer/isolators/cgroups/perf_event.hpp
index a546697..4ad6cb9 100644
--- a/src/slave/containerizer/isolators/cgroups/perf_event.hpp
+++ b/src/slave/containerizer/isolators/cgroups/perf_event.hpp
@@ -21,6 +21,8 @@
#include <set>
+#include <mesos/slave/isolator.hpp>
+
#include <process/time.hpp>
#include <stout/hashmap.hpp>
@@ -29,8 +31,6 @@
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/filesystem/shared.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/filesystem/shared.hpp b/src/slave/containerizer/isolators/filesystem/shared.hpp
index 27c7a65..779caca 100644
--- a/src/slave/containerizer/isolators/filesystem/shared.hpp
+++ b/src/slave/containerizer/isolators/filesystem/shared.hpp
@@ -19,9 +19,9 @@
#ifndef __SHARED_FILESYSTEM_ISOLATOR_HPP__
#define __SHARED_FILESYSTEM_ISOLATOR_HPP__
-#include "slave/flags.hpp"
+#include <mesos/slave/isolator.hpp>
-#include "slave/containerizer/isolator.hpp"
+#include "slave/flags.hpp"
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/namespaces/pid.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/namespaces/pid.hpp b/src/slave/containerizer/isolators/namespaces/pid.hpp
index 21674ce..88227a3 100644
--- a/src/slave/containerizer/isolators/namespaces/pid.hpp
+++ b/src/slave/containerizer/isolators/namespaces/pid.hpp
@@ -19,9 +19,9 @@
#ifndef __NAMESPACES_PID_ISOLATOR_HPP__
#define __NAMESPACES_PID_ISOLATOR_HPP__
-#include "slave/flags.hpp"
+#include <mesos/slave/isolator.hpp>
-#include "slave/containerizer/isolator.hpp"
+#include "slave/flags.hpp"
#include <sys/types.h>
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/network/port_mapping.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/network/port_mapping.hpp b/src/slave/containerizer/isolators/network/port_mapping.hpp
index a74bd65..d0d5619 100644
--- a/src/slave/containerizer/isolators/network/port_mapping.hpp
+++ b/src/slave/containerizer/isolators/network/port_mapping.hpp
@@ -26,6 +26,8 @@
#include <string>
#include <vector>
+#include <mesos/slave/isolator.hpp>
+
#include <process/owned.hpp>
#include <process/subprocess.hpp>
@@ -45,8 +47,6 @@
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/posix.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix.hpp b/src/slave/containerizer/isolators/posix.hpp
index 0d59384..f871606 100644
--- a/src/slave/containerizer/isolators/posix.hpp
+++ b/src/slave/containerizer/isolators/posix.hpp
@@ -19,6 +19,8 @@
#ifndef __POSIX_ISOLATOR_HPP__
#define __POSIX_ISOLATOR_HPP__
+#include <mesos/slave/isolator.hpp>
+
#include <stout/hashmap.hpp>
#include <stout/os/pstree.hpp>
@@ -27,8 +29,6 @@
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
#include "usage/usage.hpp"
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/isolators/posix/disk.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix/disk.hpp b/src/slave/containerizer/isolators/posix/disk.hpp
index 4760d06..f5b294e 100644
--- a/src/slave/containerizer/isolators/posix/disk.hpp
+++ b/src/slave/containerizer/isolators/posix/disk.hpp
@@ -21,6 +21,8 @@
#include <string>
+#include <mesos/slave/isolator.hpp>
+
#include <process/owned.hpp>
#include <stout/bytes.hpp>
@@ -29,8 +31,6 @@
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/launcher.hpp b/src/slave/containerizer/launcher.hpp
index 75ade8b..f292e2d 100644
--- a/src/slave/containerizer/launcher.hpp
+++ b/src/slave/containerizer/launcher.hpp
@@ -23,6 +23,8 @@
#include <map>
#include <string>
+#include <mesos/slave/isolator.hpp>
+
#include <process/future.hpp>
#include <process/subprocess.hpp>
@@ -33,8 +35,6 @@
#include "slave/flags.hpp"
-#include "slave/containerizer/isolator.hpp"
-
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index e1b85b6..9910a17 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <mesos/slave/isolator.hpp>
+
#include <process/collect.hpp>
#include <process/defer.hpp>
#include <process/io.hpp>
@@ -32,7 +34,6 @@
#include "slave/containerizer/containerizer.hpp"
#include "slave/containerizer/fetcher.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
#ifdef __linux__
#include "slave/containerizer/linux_launcher.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 293c2d8..b7015be 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -22,13 +22,14 @@
#include <list>
#include <vector>
+#include <mesos/slave/isolator.hpp>
+
#include <stout/hashmap.hpp>
#include <stout/multihashmap.hpp>
#include "slave/state.hpp"
#include "slave/containerizer/containerizer.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/tests/containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer_tests.cpp b/src/tests/containerizer_tests.cpp
index 7300333..0678849 100644
--- a/src/tests/containerizer_tests.cpp
+++ b/src/tests/containerizer_tests.cpp
@@ -22,17 +22,18 @@
#include <gmock/gmock.h>
+#include <mesos/mesos.hpp>
+
+#include <mesos/slave/isolator.hpp>
+
#include <process/future.hpp>
#include <process/owned.hpp>
#include <stout/strings.hpp>
-#include <mesos/mesos.hpp>
-
#include "slave/flags.hpp"
#include "slave/containerizer/fetcher.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
#include "slave/containerizer/mesos/containerizer.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/tests/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/tests/isolator.hpp b/src/tests/isolator.hpp
index 547b0bb..5ad338b 100644
--- a/src/tests/isolator.hpp
+++ b/src/tests/isolator.hpp
@@ -21,7 +21,7 @@
#include <gmock/gmock.h>
-#include "slave/containerizer/isolator.hpp"
+#include <mesos/slave/isolator.hpp>
namespace mesos {
namespace tests {
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/tests/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/isolator_tests.cpp b/src/tests/isolator_tests.cpp
index 093b9fd..7123a40 100644
--- a/src/tests/isolator_tests.cpp
+++ b/src/tests/isolator_tests.cpp
@@ -26,6 +26,8 @@
#include <mesos/resources.hpp>
+#include <mesos/slave/isolator.hpp>
+
#include <process/future.hpp>
#include <process/owned.hpp>
#include <process/reap.hpp>
@@ -47,7 +49,6 @@
#include "slave/flags.hpp"
#include "slave/slave.hpp"
-#include "slave/containerizer/isolator.hpp"
#ifdef __linux__
#include "slave/containerizer/isolators/cgroups/cpushare.hpp"
#include "slave/containerizer/isolators/cgroups/mem.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/tests/module_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module_tests.cpp b/src/tests/module_tests.cpp
index c9d7381..5131309 100644
--- a/src/tests/module_tests.cpp
+++ b/src/tests/module_tests.cpp
@@ -20,6 +20,8 @@
#include <mesos/module/module.hpp>
+#include <mesos/slave/isolator.hpp>
+
#include <stout/dynamiclibrary.hpp>
#include <stout/os.hpp>
@@ -27,7 +29,6 @@
#include "examples/test_module.hpp"
#include "module/isolator.hpp"
#include "module/manager.hpp"
-#include "slave/containerizer/isolator.hpp"
#include "tests/flags.hpp"
#include "tests/mesos.hpp"
@@ -35,9 +36,9 @@
using std::string;
using namespace mesos;
+using namespace mesos::modules;
using namespace mesos::slave;
using namespace mesos::tests;
-using namespace mesos::modules;
const char* DEFAULT_MODULE_LIBRARY_NAME = "examplemodule";
const char* DEFAULT_MODULE_NAME = "org_apache_mesos_TestModule";
http://git-wip-us.apache.org/repos/asf/mesos/blob/0082eb6d/src/tests/port_mapping_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/port_mapping_tests.cpp b/src/tests/port_mapping_tests.cpp
index 462e49a..308f629 100644
--- a/src/tests/port_mapping_tests.cpp
+++ b/src/tests/port_mapping_tests.cpp
@@ -72,6 +72,7 @@ using namespace routing::queueing;
using mesos::master::Master;
+using mesos::slave::Isolator;
using mesos::slave::Launcher;
using mesos::slave::LinuxLauncher;
using mesos::slave::MesosContainerizer;
[7/9] mesos git commit: Out of tree build 7: Moved authentication
messages to mesos/authentication.proto.
Posted by nn...@apache.org.
Out of tree build 7: Moved authentication messages to mesos/authentication.proto.
To allow authentication modules being built outside the Mesos source
tree to use protobufs related to authentication.
Review: https://reviews.apache.org/r/29605
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4ca1b1bc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4ca1b1bc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4ca1b1bc
Branch: refs/heads/master
Commit: 4ca1b1bc3b9f4e384af5ec6d1517aff46e6a9a89
Parents: 4573223
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:55:36 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:55:36 2015 -0800
----------------------------------------------------------------------
include/mesos/authentication/authentication.hpp | 25 +++++++++
.../mesos/authentication/authentication.proto | 56 ++++++++++++++++++++
src/Makefile.am | 22 +++++++-
src/authentication/authenticatee.hpp | 2 +
src/authentication/authenticator.hpp | 2 +
src/messages/messages.proto | 32 -----------
src/tests/authentication_tests.cpp | 2 +
src/tests/fault_tolerance_tests.cpp | 2 +
8 files changed, 109 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/include/mesos/authentication/authentication.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/authentication/authentication.hpp b/include/mesos/authentication/authentication.hpp
new file mode 100644
index 0000000..699aa88
--- /dev/null
+++ b/include/mesos/authentication/authentication.hpp
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_AUTHENTICATION_AUTHENTICATION_HPP__
+#define __MESOS_AUTHENTICATION_AUTHENTICATION_HPP__
+
+// ONLY USEFUL AFTER RUNNING PROTOC.
+#include <mesos/authentication/authentication.pb.h>
+
+#endif // __MESOS_AUTHENTICATION_AUTHENTICATION_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/include/mesos/authentication/authentication.proto
----------------------------------------------------------------------
diff --git a/include/mesos/authentication/authentication.proto b/include/mesos/authentication/authentication.proto
new file mode 100644
index 0000000..38a6f78
--- /dev/null
+++ b/include/mesos/authentication/authentication.proto
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+import "mesos/mesos.proto";
+
+package mesos;
+
+option java_package = "org.apache.mesos";
+option java_outer_classname = "Protos";
+
+
+message AuthenticateMessage {
+ required string pid = 1; // PID that needs to be authenticated.
+}
+
+
+message AuthenticationMechanismsMessage {
+ repeated string mechanisms = 1; // List of available SASL mechanisms.
+}
+
+
+message AuthenticationStartMessage {
+ required string mechanism = 1;
+ optional bytes data = 2;
+}
+
+
+message AuthenticationStepMessage {
+ required bytes data = 1;
+}
+
+
+message AuthenticationCompletedMessage {}
+
+
+message AuthenticationFailedMessage {}
+
+
+message AuthenticationErrorMessage {
+ optional string error = 1;
+}
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 471af11..a225321 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -131,6 +131,9 @@ endif
MESOS_PROTO = $(top_srcdir)/include/mesos/mesos.proto
+AUTHENTICATION_PROTO = \
+ $(top_srcdir)/include/mesos/authentication/authentication.proto
+
CONTAINERIZER_PROTO = \
$(top_srcdir)/include/mesos/containerizer/containerizer.proto
@@ -146,6 +149,8 @@ SCHEDULER_PROTO = \
CXX_PROTOS = \
mesos.pb.cc \
../include/mesos/mesos.pb.h \
+ authentication/authentication.pb.cc \
+ ../include/mesos/authentication/authentication.pb.h \
containerizer/containerizer.pb.cc \
../include/mesos/containerizer/containerizer.pb.h \
fetcher/fetcher.pb.cc \
@@ -194,6 +199,12 @@ CLEANFILES += $(REGISTRY_PROTOS)
$(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
mv ../include/mesos/*.pb.cc .
+authentication/%.pb.cc ../include/mesos/authentication/%.pb.h: $(AUTHENTICATION_PROTO)
+ $(MKDIR_P) $(@D)
+ $(MKDIR_P) ../include/mesos/authentication
+ $(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
+ mv ../include/mesos/authentication/*.pb.cc $(@D)
+
containerizer/%.pb.cc ../include/mesos/containerizer/%.pb.h: $(CONTAINERIZER_PROTO)
$(MKDIR_P) $(@D)
$(MKDIR_P) ../include/mesos/containerizer
@@ -354,8 +365,15 @@ pkginclude_HEADERS = \
nodist_pkginclude_HEADERS = \
../include/mesos/version.hpp \
- ../include/mesos/mesos.pb.h \
- ../include/mesos/module.pb.h
+ ../include/mesos/mesos.pb.h
+
+authenticationdir = $(pkgincludedir)/authentication
+
+authentication_HEADERS = \
+ $(top_srcdir)/include/mesos/authentication/authentication.hpp \
+ $(top_srcdir)/include/mesos/authentication/authentication.proto
+
+nodist_authentication_HEADERS = ../include/mesos/authentication/authentication.pb.h
containerizerdir = $(pkgincludedir)/containerizer
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/authentication/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/authenticatee.hpp b/src/authentication/authenticatee.hpp
index 95798d7..ba90b3b 100644
--- a/src/authentication/authenticatee.hpp
+++ b/src/authentication/authenticatee.hpp
@@ -21,6 +21,8 @@
#include <mesos/mesos.hpp>
+#include <mesos/authentication/authentication.hpp>
+
#include <process/future.hpp>
#include <stout/nothing.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/authentication/authenticator.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/authenticator.hpp b/src/authentication/authenticator.hpp
index abc2a23..5b1375f 100644
--- a/src/authentication/authenticator.hpp
+++ b/src/authentication/authenticator.hpp
@@ -21,6 +21,8 @@
#include <mesos/mesos.hpp>
+#include <mesos/authentication/authentication.hpp>
+
#include <process/future.hpp>
#include <process/pid.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/messages/messages.proto
----------------------------------------------------------------------
diff --git a/src/messages/messages.proto b/src/messages/messages.proto
index 70b0bdc..55b3a24 100644
--- a/src/messages/messages.proto
+++ b/src/messages/messages.proto
@@ -387,38 +387,6 @@ message ShutdownMessage {
}
-message AuthenticateMessage {
- required string pid = 1; // PID that needs to be authenticated.
-}
-
-
-message AuthenticationMechanismsMessage {
- repeated string mechanisms = 1; // List of available SASL mechanisms.
-}
-
-
-message AuthenticationStartMessage {
- required string mechanism = 1;
- optional bytes data = 2;
-}
-
-
-message AuthenticationStepMessage {
- required bytes data = 1;
-}
-
-
-message AuthenticationCompletedMessage {}
-
-
-message AuthenticationFailedMessage {}
-
-
-message AuthenticationErrorMessage {
- optional string error = 1;
-}
-
-
// TODO(adam-mesos): Move this to an 'archive' package.
/**
* Describes Completed Frameworks, etc. for archival.
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/tests/authentication_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/authentication_tests.cpp b/src/tests/authentication_tests.cpp
index 48f73e2..59d2954 100644
--- a/src/tests/authentication_tests.cpp
+++ b/src/tests/authentication_tests.cpp
@@ -22,6 +22,8 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/authentication/authentication.hpp>
+
#include <process/dispatch.hpp>
#include <process/gmock.hpp>
#include <process/owned.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/4ca1b1bc/src/tests/fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fault_tolerance_tests.cpp b/src/tests/fault_tolerance_tests.cpp
index c811873..dc8efcd 100644
--- a/src/tests/fault_tolerance_tests.cpp
+++ b/src/tests/fault_tolerance_tests.cpp
@@ -24,6 +24,8 @@
#include <mesos/mesos.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/authentication/authentication.hpp>
+
#include <process/future.hpp>
#include <process/gmock.hpp>
#include <process/http.hpp>
[3/9] mesos git commit: Out of tree build 3: Exposed type_utils.hpp
as include/mesos/type_utils.hpp.
Posted by nn...@apache.org.
Out of tree build 3: Exposed type_utils.hpp as include/mesos/type_utils.hpp.
This file includes definitions for operators on public protobufs
(defined in mesos.proto) that don't have these operators generated by
the protobuf compiler. The corresponding definitions are in
src/common/type\_utils.cpp.
Mesos modules need some of the protobufs defined in mesos.proto and
require some of these operators declared in type\_utils.hpp. Exposing
type\_utils.hpp allows us to build modules without having a dependency
on mesos source tree (src/\*).
Review: https://reviews.apache.org/r/29781
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bcb01dba
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bcb01dba
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bcb01dba
Branch: refs/heads/master
Commit: bcb01dba9a2dad351a88f0f8580ccbf277249229
Parents: 1d68340
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:53:32 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:53:32 2015 -0800
----------------------------------------------------------------------
include/mesos/type_utils.hpp | 371 +++++++++++++++++++
src/Makefile.am | 2 +-
src/cli/execute.cpp | 2 +-
src/common/protobuf_utils.cpp | 4 +-
src/common/type_utils.cpp | 2 +-
src/common/type_utils.hpp | 363 ------------------
src/examples/low_level_scheduler_libprocess.cpp | 3 +-
src/examples/low_level_scheduler_pthread.cpp | 3 +-
src/examples/no_executor_framework.cpp | 3 +-
src/examples/test_framework.cpp | 3 +-
src/exec/exec.cpp | 2 +-
src/launcher/executor.cpp | 2 +-
src/log/coordinator.cpp | 4 +-
src/log/recover.cpp | 4 +-
src/log/replica.cpp | 4 +-
src/master/http.cpp | 3 +-
src/master/master.hpp | 2 +-
src/master/registrar.cpp | 4 +-
src/master/validation.cpp | 4 +-
src/sched/sched.cpp | 2 +-
src/scheduler/scheduler.cpp | 2 +-
.../containerizer/external_containerizer.cpp | 3 +-
.../isolators/cgroups/cpushare.cpp | 5 +-
.../containerizer/isolators/cgroups/mem.cpp | 3 +-
src/slave/flags.hpp | 1 +
src/slave/http.cpp | 3 +-
src/slave/monitor.hpp | 3 +-
src/slave/paths.cpp | 4 +-
src/slave/slave.cpp | 3 +-
src/slave/slave.hpp | 2 +-
src/slave/state.hpp | 5 +-
src/slave/status_update_manager.hpp | 4 +-
src/tests/flags.hpp | 3 +-
src/tests/protobuf_io_tests.cpp | 4 +-
src/tests/registrar_tests.cpp | 3 +-
src/tests/state_tests.cpp | 3 +-
36 files changed, 421 insertions(+), 417 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
new file mode 100644
index 0000000..32dc6ed
--- /dev/null
+++ b/include/mesos/type_utils.hpp
@@ -0,0 +1,371 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_TYPE_UTILS_H__
+#define __MESOS_TYPE_UTILS_H__
+
+#include <boost/functional/hash.hpp>
+
+#include <mesos/mesos.hpp>
+
+#include <mesos/module/module.hpp>
+
+#include <stout/uuid.hpp>
+
+// This file includes definitions for operators on public protobuf
+// classes (defined in mesos.proto, module.proto, etc.) that don't
+// have these operators generated by the protobuf compiler. The
+// corresponding definitions are in src/common/type_utils.cpp.
+//
+// Mesos modules need some of the protobuf classes defined in
+// mesos.proto, module.proto, etc., and require some of these
+// operators declared in type_utils.hpp. Exposing type_utils.hpp
+// allows us to build modules without having a dependency on mesos
+// source tree (src/*).
+
+namespace mesos {
+
+bool operator == (const CommandInfo& left, const CommandInfo& right);
+bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right);
+bool operator == (const Credential& left, const Credential& right);
+bool operator == (const Environment& left, const Environment& right);
+bool operator == (const ExecutorInfo& left, const ExecutorInfo& right);
+bool operator == (const MasterInfo& left, const MasterInfo& right);
+bool operator == (const SlaveInfo& left, const SlaveInfo& right);
+bool operator == (const Volume& left, const Volume& right);
+
+
+inline bool operator == (const ContainerID& left, const ContainerID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const ExecutorID& left, const ExecutorID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const FrameworkID& left, const FrameworkID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const FrameworkInfo& left, const FrameworkInfo& right)
+{
+ return (left.name() == right.name()) && (left.user() == right.user());
+}
+
+
+inline bool operator == (const OfferID& left, const OfferID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const SlaveID& left, const SlaveID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const TaskID& left, const TaskID& right)
+{
+ return left.value() == right.value();
+}
+
+
+inline bool operator == (const ContainerID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator == (const ExecutorID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator == (const FrameworkID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator == (const OfferID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator == (const SlaveID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator == (const TaskID& left, const std::string& right)
+{
+ return left.value() == right;
+}
+
+
+inline bool operator != (const ContainerID& left, const ContainerID& right)
+{
+ return left.value() != right.value();
+}
+
+
+inline bool operator != (const FrameworkID& left, const FrameworkID& right)
+{
+ return left.value() != right.value();
+}
+
+
+inline bool operator != (const SlaveID& left, const SlaveID& right)
+{
+ return left.value() != right.value();
+}
+
+
+inline bool operator < (const ContainerID& left, const ContainerID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline bool operator < (const ExecutorID& left, const ExecutorID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline bool operator < (const FrameworkID& left, const FrameworkID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline bool operator < (const OfferID& left, const OfferID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline bool operator < (const SlaveID& left, const SlaveID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline bool operator < (const TaskID& left, const TaskID& right)
+{
+ return left.value() < right.value();
+}
+
+
+inline std::size_t hash_value(const ContainerID& containerId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, containerId.value());
+ return seed;
+}
+
+
+inline std::size_t hash_value(const ExecutorID& executorId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, executorId.value());
+ return seed;
+}
+
+
+inline std::size_t hash_value(const FrameworkID& frameworkId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, frameworkId.value());
+ return seed;
+}
+
+
+inline std::size_t hash_value(const OfferID& offerId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, offerId.value());
+ return seed;
+}
+
+
+inline std::size_t hash_value(const SlaveID& slaveId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, slaveId.value());
+ return seed;
+}
+
+
+inline std::size_t hash_value(const TaskID& taskId)
+{
+ size_t seed = 0;
+ boost::hash_combine(seed, taskId.value());
+ return seed;
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const ACLs& acls)
+{
+ return stream << acls.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const ContainerID& containerId)
+{
+ return stream << containerId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const ContainerInfo& containerInfo)
+{
+ return stream << containerInfo.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const ExecutorID& executorId)
+{
+ return stream << executorId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const ExecutorInfo& executor)
+{
+ return stream << executor.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const FrameworkID& frameworkId)
+{
+ return stream << frameworkId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const MasterInfo& master)
+{
+ return stream << master.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const OfferID& offerId)
+{
+ return stream << offerId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const RateLimits& limits)
+{
+ return stream << limits.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const SlaveID& slaveId)
+{
+ return stream << slaveId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const SlaveInfo& slave)
+{
+ return stream << slave.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const TaskID& taskId)
+{
+ return stream << taskId.value();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const TaskInfo& task)
+{
+ return stream << task.DebugString();
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const TaskState& state)
+{
+ return stream << TaskState_descriptor()->FindValueByNumber(state)->name();
+}
+
+
+template <typename T>
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const google::protobuf::RepeatedPtrField<T>& messages)
+{
+ stream << "[ ";
+ for (auto it = messages.begin(); it != messages.end(); ++it) {
+ if (it != messages.begin()) {
+ stream << ", ";
+ }
+ stream << *it;
+ }
+ stream << " ]";
+ return stream;
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const Modules& modules)
+{
+ return stream << modules.DebugString();
+}
+
+} // namespace mesos {
+
+#endif // __MESOS_TYPE_UTILS_H__
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 1790a60..7e26f23 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -348,6 +348,7 @@ pkginclude_HEADERS = \
$(top_srcdir)/include/mesos/module.hpp \
$(top_srcdir)/include/mesos/resources.hpp \
$(top_srcdir)/include/mesos/scheduler.hpp \
+ $(top_srcdir)/include/mesos/type_utils.hpp \
$(top_srcdir)/include/mesos/values.hpp \
$(top_srcdir)/include/mesos/mesos.proto
@@ -455,7 +456,6 @@ libmesos_no_3rdparty_la_SOURCES += \
common/parse.hpp \
common/protobuf_utils.hpp \
common/status_utils.hpp \
- common/type_utils.hpp \
common/thread.hpp \
credentials/credentials.hpp \
examples/utils.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index ea74049..c55e961 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -21,6 +21,7 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <process/pid.hpp>
@@ -30,7 +31,6 @@
#include <stout/option.hpp>
#include <stout/os.hpp>
-#include "common/type_utils.hpp"
#include "common/protobuf_utils.hpp"
#include "hdfs/hdfs.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/common/protobuf_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index af6b785..c398c58 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <mesos/type_utils.hpp>
+
#include <process/clock.hpp>
#include <process/pid.hpp>
@@ -23,8 +25,6 @@
#include <stout/stringify.hpp>
#include <stout/uuid.hpp>
-#include "common/type_utils.hpp"
-
#include "messages/messages.hpp"
using std::string;
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index 206cdfc..12a36bb 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -18,9 +18,9 @@
#include <mesos/mesos.hpp>
#include <mesos/resources.hpp>
+#include <mesos/type_utils.hpp>
#include "common/attributes.hpp"
-#include "common/type_utils.hpp"
#include "messages/messages.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/common/type_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.hpp b/src/common/type_utils.hpp
deleted file mode 100644
index 9abfb1c..0000000
--- a/src/common/type_utils.hpp
+++ /dev/null
@@ -1,363 +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.
- */
-
-#ifndef __TYPE_UTILS_HPP__
-#define __TYPE_UTILS_HPP__
-
-#include <boost/functional/hash.hpp>
-
-#include <mesos/mesos.hpp>
-
-#include <mesos/module/module.hpp>
-
-#include <stout/uuid.hpp>
-
-// This file includes definitions for operators on protobuf classes
-// that don't have these operators generated by the protobuf compiler.
-
-namespace mesos {
-
-bool operator == (const CommandInfo& left, const CommandInfo& right);
-bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right);
-bool operator == (const Credential& left, const Credential& right);
-bool operator == (const Environment& left, const Environment& right);
-bool operator == (const ExecutorInfo& left, const ExecutorInfo& right);
-bool operator == (const MasterInfo& left, const MasterInfo& right);
-bool operator == (const SlaveInfo& left, const SlaveInfo& right);
-bool operator == (const Volume& left, const Volume& right);
-
-
-inline bool operator == (const ContainerID& left, const ContainerID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const ExecutorID& left, const ExecutorID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const FrameworkID& left, const FrameworkID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const FrameworkInfo& left, const FrameworkInfo& right)
-{
- return (left.name() == right.name()) && (left.user() == right.user());
-}
-
-
-inline bool operator == (const OfferID& left, const OfferID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const SlaveID& left, const SlaveID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const TaskID& left, const TaskID& right)
-{
- return left.value() == right.value();
-}
-
-
-inline bool operator == (const ContainerID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator == (const ExecutorID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator == (const FrameworkID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator == (const OfferID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator == (const SlaveID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator == (const TaskID& left, const std::string& right)
-{
- return left.value() == right;
-}
-
-
-inline bool operator != (const ContainerID& left, const ContainerID& right)
-{
- return left.value() != right.value();
-}
-
-
-inline bool operator != (const FrameworkID& left, const FrameworkID& right)
-{
- return left.value() != right.value();
-}
-
-
-inline bool operator != (const SlaveID& left, const SlaveID& right)
-{
- return left.value() != right.value();
-}
-
-
-inline bool operator < (const ContainerID& left, const ContainerID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline bool operator < (const ExecutorID& left, const ExecutorID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline bool operator < (const FrameworkID& left, const FrameworkID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline bool operator < (const OfferID& left, const OfferID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline bool operator < (const SlaveID& left, const SlaveID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline bool operator < (const TaskID& left, const TaskID& right)
-{
- return left.value() < right.value();
-}
-
-
-inline std::size_t hash_value(const ContainerID& containerId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, containerId.value());
- return seed;
-}
-
-
-inline std::size_t hash_value(const ExecutorID& executorId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, executorId.value());
- return seed;
-}
-
-
-inline std::size_t hash_value(const FrameworkID& frameworkId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, frameworkId.value());
- return seed;
-}
-
-
-inline std::size_t hash_value(const OfferID& offerId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, offerId.value());
- return seed;
-}
-
-
-inline std::size_t hash_value(const SlaveID& slaveId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, slaveId.value());
- return seed;
-}
-
-
-inline std::size_t hash_value(const TaskID& taskId)
-{
- size_t seed = 0;
- boost::hash_combine(seed, taskId.value());
- return seed;
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const ACLs& acls)
-{
- return stream << acls.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const ContainerID& containerId)
-{
- return stream << containerId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const ContainerInfo& containerInfo)
-{
- return stream << containerInfo.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const ExecutorID& executorId)
-{
- return stream << executorId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const ExecutorInfo& executor)
-{
- return stream << executor.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const FrameworkID& frameworkId)
-{
- return stream << frameworkId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const MasterInfo& master)
-{
- return stream << master.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const OfferID& offerId)
-{
- return stream << offerId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const RateLimits& limits)
-{
- return stream << limits.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const SlaveID& slaveId)
-{
- return stream << slaveId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const SlaveInfo& slave)
-{
- return stream << slave.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const TaskID& taskId)
-{
- return stream << taskId.value();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const TaskInfo& task)
-{
- return stream << task.DebugString();
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const TaskState& state)
-{
- return stream << TaskState_descriptor()->FindValueByNumber(state)->name();
-}
-
-
-template <typename T>
-inline std::ostream& operator << (
- std::ostream& stream,
- const google::protobuf::RepeatedPtrField<T>& messages)
-{
- stream << "[ ";
- for (auto it = messages.begin(); it != messages.end(); ++it) {
- if (it != messages.begin()) {
- stream << ", ";
- }
- stream << *it;
- }
- stream << " ]";
- return stream;
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const Modules& modules)
-{
- return stream << modules.DebugString();
-}
-
-} // namespace mesos {
-
-#endif // __TYPE_UTILS_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/examples/low_level_scheduler_libprocess.cpp
----------------------------------------------------------------------
diff --git a/src/examples/low_level_scheduler_libprocess.cpp b/src/examples/low_level_scheduler_libprocess.cpp
index cd04187..986b175 100644
--- a/src/examples/low_level_scheduler_libprocess.cpp
+++ b/src/examples/low_level_scheduler_libprocess.cpp
@@ -26,6 +26,7 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <process/delay.hpp>
#include <process/process.hpp>
@@ -43,8 +44,6 @@
#include <stout/os.hpp>
#include <stout/stringify.hpp>
-#include "common/type_utils.hpp"
-
#include "logging/flags.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/examples/low_level_scheduler_pthread.cpp
----------------------------------------------------------------------
diff --git a/src/examples/low_level_scheduler_pthread.cpp b/src/examples/low_level_scheduler_pthread.cpp
index f4bd4ac..d69e68b 100644
--- a/src/examples/low_level_scheduler_pthread.cpp
+++ b/src/examples/low_level_scheduler_pthread.cpp
@@ -28,6 +28,7 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <process/protobuf.hpp>
@@ -42,8 +43,6 @@
#include <stout/os.hpp>
#include <stout/stringify.hpp>
-#include "common/type_utils.hpp"
-
#include "logging/flags.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/examples/no_executor_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/no_executor_framework.cpp b/src/examples/no_executor_framework.cpp
index 5e47cfc..37001c3 100644
--- a/src/examples/no_executor_framework.cpp
+++ b/src/examples/no_executor_framework.cpp
@@ -25,6 +25,7 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <stout/check.hpp>
#include <stout/exit.hpp>
@@ -32,8 +33,6 @@
#include <stout/os.hpp>
#include <stout/stringify.hpp>
-#include "common/type_utils.hpp"
-
using namespace mesos;
using boost::lexical_cast;
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/examples/test_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_framework.cpp b/src/examples/test_framework.cpp
index 3dfb6a0..0a4fde5 100644
--- a/src/examples/test_framework.cpp
+++ b/src/examples/test_framework.cpp
@@ -25,6 +25,7 @@
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <stout/check.hpp>
#include <stout/exit.hpp>
@@ -33,8 +34,6 @@
#include <stout/os.hpp>
#include <stout/stringify.hpp>
-#include "common/type_utils.hpp"
-
#include "logging/flags.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/exec/exec.cpp
----------------------------------------------------------------------
diff --git a/src/exec/exec.cpp b/src/exec/exec.cpp
index 38c8ee7..3492943 100644
--- a/src/exec/exec.cpp
+++ b/src/exec/exec.cpp
@@ -26,6 +26,7 @@
#include <mesos/executor.hpp>
#include <mesos/mesos.hpp>
+#include <mesos/type_utils.hpp>
#include <process/delay.hpp>
#include <process/dispatch.hpp>
@@ -46,7 +47,6 @@
#include "common/lock.hpp"
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "logging/flags.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index 8c2f2e6..8f47f0e 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -27,6 +27,7 @@
#include <vector>
#include <mesos/executor.hpp>
+#include <mesos/type_utils.hpp>
#include <process/defer.hpp>
#include <process/delay.hpp>
@@ -48,7 +49,6 @@
#include <stout/strings.hpp>
#include "common/http.hpp"
-#include "common/type_utils.hpp"
#include "common/status_utils.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/log/coordinator.cpp
----------------------------------------------------------------------
diff --git a/src/log/coordinator.cpp b/src/log/coordinator.cpp
index 9a4383d..b97e133 100644
--- a/src/log/coordinator.cpp
+++ b/src/log/coordinator.cpp
@@ -20,6 +20,8 @@
#include <algorithm>
+#include <mesos/type_utils.hpp>
+
#include <process/defer.hpp>
#include <process/dispatch.hpp>
#include <process/id.hpp>
@@ -27,8 +29,6 @@
#include <stout/none.hpp>
-#include "common/type_utils.hpp"
-
#include "log/catchup.hpp"
#include "log/consensus.hpp"
#include "log/coordinator.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/log/recover.cpp
----------------------------------------------------------------------
diff --git a/src/log/recover.cpp b/src/log/recover.cpp
index 0ca7371..3e175f3 100644
--- a/src/log/recover.cpp
+++ b/src/log/recover.cpp
@@ -21,6 +21,8 @@
#include <set>
+#include <mesos/type_utils.hpp>
+
#include <process/defer.hpp>
#include <process/delay.hpp>
#include <process/id.hpp>
@@ -34,8 +36,6 @@
#include <stout/none.hpp>
#include <stout/option.hpp>
-#include "common/type_utils.hpp"
-
#include "log/catchup.hpp"
#include "log/recover.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/log/replica.cpp
----------------------------------------------------------------------
diff --git a/src/log/replica.cpp b/src/log/replica.cpp
index 2b748b3..83cb3e7 100644
--- a/src/log/replica.cpp
+++ b/src/log/replica.cpp
@@ -20,6 +20,8 @@
#include <algorithm>
+#include <mesos/type_utils.hpp>
+
#include <process/dispatch.hpp>
#include <process/id.hpp>
@@ -32,8 +34,6 @@
#include <stout/try.hpp>
#include <stout/utils.hpp>
-#include "common/type_utils.hpp"
-
#include "log/leveldb.hpp"
#include "log/replica.hpp"
#include "log/storage.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index ff9f053..5e3afdf 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -24,6 +24,8 @@
#include <boost/array.hpp>
+#include <mesos/type_utils.hpp>
+
#include <process/help.hpp>
#include <process/metrics/metrics.hpp>
@@ -45,7 +47,6 @@
#include "common/build.hpp"
#include "common/http.hpp"
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "logging/logging.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 00b07d0..4f934c0 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -30,6 +30,7 @@
#include <mesos/mesos.hpp>
#include <mesos/resources.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <process/http.hpp>
#include <process/owned.hpp>
@@ -46,7 +47,6 @@
#include <stout/option.hpp>
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "files/files.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/master/registrar.cpp
----------------------------------------------------------------------
diff --git a/src/master/registrar.cpp b/src/master/registrar.cpp
index d2c5c3d..2bfc053 100644
--- a/src/master/registrar.cpp
+++ b/src/master/registrar.cpp
@@ -19,6 +19,8 @@
#include <deque>
#include <string>
+#include <mesos/type_utils.hpp>
+
#include <process/defer.hpp>
#include <process/dispatch.hpp>
#include <process/future.hpp>
@@ -39,8 +41,6 @@
#include <stout/protobuf.hpp>
#include <stout/stopwatch.hpp>
-#include "common/type_utils.hpp"
-
#include "master/registrar.hpp"
#include "master/registry.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 79dfaa1..acc35b2 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -22,6 +22,8 @@
#include <glog/logging.h>
+#include <mesos/type_utils.hpp>
+
#include <stout/foreach.hpp>
#include <stout/hashmap.hpp>
#include <stout/hashset.hpp>
@@ -29,8 +31,6 @@
#include <stout/none.hpp>
#include <stout/stringify.hpp>
-#include "common/type_utils.hpp"
-
#include "master/master.hpp"
#include "master/validation.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 1af52b2..03d1d13 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -33,6 +33,7 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <mesos/scheduler/scheduler.hpp>
@@ -66,7 +67,6 @@
#include "authentication/cram_md5/authenticatee.hpp"
#include "common/lock.hpp"
-#include "common/type_utils.hpp"
#include "local/flags.hpp"
#include "local/local.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index de7d0bb..d4eb195 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -31,6 +31,7 @@
#include <mesos/mesos.hpp>
#include <mesos/scheduler.hpp>
+#include <mesos/type_utils.hpp>
#include <process/async.hpp>
#include <process/defer.hpp>
@@ -56,7 +57,6 @@
#include "authentication/authenticatee.hpp"
#include "authentication/cram_md5/authenticatee.hpp"
-#include "common/type_utils.hpp"
#include "master/detector.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/containerizer/external_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.cpp b/src/slave/containerizer/external_containerizer.cpp
index a31d66d..79b5fc6 100644
--- a/src/slave/containerizer/external_containerizer.cpp
+++ b/src/slave/containerizer/external_containerizer.cpp
@@ -25,6 +25,8 @@
#include <signal.h>
#include <stdio.h>
+#include <mesos/type_utils.hpp>
+
#include <process/async.hpp>
#include <process/collect.hpp>
#include <process/defer.hpp>
@@ -42,7 +44,6 @@
#include <stout/strings.hpp>
#include <stout/uuid.hpp>
-#include "common/type_utils.hpp"
#include "common/status_utils.hpp"
#include "slave/paths.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/containerizer/isolators/cgroups/cpushare.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/cpushare.cpp b/src/slave/containerizer/isolators/cgroups/cpushare.cpp
index 6554ca3..91e3a01 100644
--- a/src/slave/containerizer/isolators/cgroups/cpushare.cpp
+++ b/src/slave/containerizer/isolators/cgroups/cpushare.cpp
@@ -20,8 +20,9 @@
#include <vector>
-#include <mesos/values.hpp>
#include <mesos/resources.hpp>
+#include <mesos/type_utils.hpp>
+#include <mesos/values.hpp>
#include <process/collect.hpp>
#include <process/defer.hpp>
@@ -37,8 +38,6 @@
#include <stout/stringify.hpp>
#include <stout/try.hpp>
-#include "common/type_utils.hpp"
-
#include "linux/cgroups.hpp"
#include "slave/flags.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/containerizer/isolators/cgroups/mem.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/mem.cpp b/src/slave/containerizer/isolators/cgroups/mem.cpp
index 0bb4039..276aa2b 100644
--- a/src/slave/containerizer/isolators/cgroups/mem.cpp
+++ b/src/slave/containerizer/isolators/cgroups/mem.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include <mesos/resources.hpp>
+#include <mesos/type_utils.hpp>
#include <mesos/values.hpp>
#include <process/collect.hpp>
@@ -38,8 +39,6 @@
#include <stout/stringify.hpp>
#include <stout/try.hpp>
-#include "common/type_utils.hpp"
-
#include "linux/cgroups.hpp"
#include "slave/containerizer/isolators/cgroups/mem.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index c4832bb..b446159 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -22,6 +22,7 @@
#include <string>
#include <mesos/mesos.hpp>
+#include <mesos/type_utils.hpp>
#include <mesos/module/module.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 80b02d6..ef6e648 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -21,6 +21,8 @@
#include <string>
#include <vector>
+#include <mesos/type_utils.hpp>
+
#include <process/help.hpp>
#include <process/owned.hpp>
@@ -37,7 +39,6 @@
#include "common/attributes.hpp"
#include "common/build.hpp"
#include "common/http.hpp"
-#include "common/type_utils.hpp"
#include "mesos/mesos.hpp"
#include "mesos/resources.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/monitor.hpp
----------------------------------------------------------------------
diff --git a/src/slave/monitor.hpp b/src/slave/monitor.hpp
index 2cc42dc..94f9ea6 100644
--- a/src/slave/monitor.hpp
+++ b/src/slave/monitor.hpp
@@ -25,6 +25,7 @@
#include <boost/circular_buffer.hpp>
#include <mesos/mesos.hpp>
+#include <mesos/type_utils.hpp>
#include <process/future.hpp>
#include <process/limiter.hpp>
@@ -38,8 +39,6 @@
#include <stout/option.hpp>
#include <stout/try.hpp>
-#include "common/type_utils.hpp"
-
namespace mesos {
namespace slave {
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/paths.cpp b/src/slave/paths.cpp
index 5102db5..cf08c44 100644
--- a/src/slave/paths.cpp
+++ b/src/slave/paths.cpp
@@ -20,6 +20,8 @@
#include <string>
#include <mesos/mesos.hpp>
+#include <mesos/type_utils.hpp>
+
#include <stout/check.hpp>
#include <stout/fs.hpp>
@@ -28,8 +30,6 @@
#include <stout/path.hpp>
#include <stout/try.hpp>
-#include "common/type_utils.hpp"
-
#include "messages/messages.hpp"
#include "slave/paths.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 7a29f86..d18ac27 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -29,6 +29,8 @@
#include <string>
#include <vector>
+#include <mesos/type_utils.hpp>
+
#include <process/async.hpp>
#include <process/check.hpp>
#include <process/defer.hpp>
@@ -64,7 +66,6 @@
#include "common/build.hpp"
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "common/status_utils.hpp"
#include "credentials/credentials.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 35c7c8b..abe4140 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -28,6 +28,7 @@
#include <boost/circular_buffer.hpp>
#include <mesos/resources.hpp>
+#include <mesos/type_utils.hpp>
#include <process/http.hpp>
#include <process/future.hpp>
@@ -57,7 +58,6 @@
#include "common/attributes.hpp"
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "files/files.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/state.hpp
----------------------------------------------------------------------
diff --git a/src/slave/state.hpp b/src/slave/state.hpp
index dc1aea7..e7276a5 100644
--- a/src/slave/state.hpp
+++ b/src/slave/state.hpp
@@ -24,6 +24,7 @@
#include <vector>
#include <mesos/resources.hpp>
+#include <mesos/type_utils.hpp>
#include <process/pid.hpp>
@@ -36,12 +37,8 @@
#include <stout/utils.hpp>
#include <stout/uuid.hpp>
-#include "common/type_utils.hpp"
-
#include "messages/messages.hpp"
-#include "process/pid.hpp"
-
namespace mesos {
namespace slave {
namespace state {
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/slave/status_update_manager.hpp
----------------------------------------------------------------------
diff --git a/src/slave/status_update_manager.hpp b/src/slave/status_update_manager.hpp
index cc53a2a..44b60b5 100644
--- a/src/slave/status_update_manager.hpp
+++ b/src/slave/status_update_manager.hpp
@@ -24,6 +24,8 @@
#include <string>
#include <utility>
+#include <mesos/type_utils.hpp>
+
#include <process/pid.hpp>
#include <process/process.hpp>
#include <process/protobuf.hpp>
@@ -41,8 +43,6 @@
#include <stout/utils.hpp>
#include <stout/uuid.hpp>
-#include "common/type_utils.hpp"
-
#include "logging/logging.hpp"
#include "messages/messages.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/tests/flags.hpp
----------------------------------------------------------------------
diff --git a/src/tests/flags.hpp b/src/tests/flags.hpp
index 0be991f..3155d89 100644
--- a/src/tests/flags.hpp
+++ b/src/tests/flags.hpp
@@ -21,12 +21,13 @@
#include <string>
+#include <mesos/type_utils.hpp>
+
#include <stout/check.hpp>
#include <stout/flags.hpp>
#include <stout/os.hpp>
#include "common/parse.hpp"
-#include "common/type_utils.hpp"
#include "logging/logging.hpp"
#include "master/constants.hpp"
#include "messages/messages.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/tests/protobuf_io_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/protobuf_io_tests.cpp b/src/tests/protobuf_io_tests.cpp
index a54f20d..92a090a 100644
--- a/src/tests/protobuf_io_tests.cpp
+++ b/src/tests/protobuf_io_tests.cpp
@@ -20,14 +20,14 @@
#include <gmock/gmock.h>
+#include <mesos/type_utils.hpp>
+
#include <stout/gtest.hpp>
#include <stout/none.hpp>
#include <stout/os.hpp>
#include <stout/protobuf.hpp>
#include <stout/result.hpp>
-#include "common/type_utils.hpp"
-
#include "messages/messages.hpp"
#include "tests/utils.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index 510595d..fd31293 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -22,6 +22,8 @@
#include <string>
#include <vector>
+#include <mesos/type_utils.hpp>
+
#include <process/gmock.hpp>
#include <process/gtest.hpp>
#include <process/pid.hpp>
@@ -33,7 +35,6 @@
#include "common/attributes.hpp"
#include "common/protobuf_utils.hpp"
-#include "common/type_utils.hpp"
#include "log/log.hpp"
#include "log/replica.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb01dba/src/tests/state_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/state_tests.cpp b/src/tests/state_tests.cpp
index 4a216e6..b308123 100644
--- a/src/tests/state_tests.cpp
+++ b/src/tests/state_tests.cpp
@@ -24,6 +24,7 @@
#include <vector>
#include <mesos/mesos.hpp>
+#include <mesos/type_utils.hpp>
#include <process/future.hpp>
#include <process/gtest.hpp>
@@ -37,8 +38,6 @@
#include <stout/protobuf.hpp>
-#include "common/type_utils.hpp"
-
#include "log/log.hpp"
#include "log/replica.hpp"
[8/9] mesos git commit: Out of tree build 8: Exposed authentication
headers.
Posted by nn...@apache.org.
Out of tree build 8: Exposed authentication headers.
This allows authentication modules to be built outside the mesos
source tree.
Review: https://reviews.apache.org/r/29606
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dd3870c6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dd3870c6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dd3870c6
Branch: refs/heads/master
Commit: dd3870c65195e320d584d2f766407d3466d95347
Parents: 4ca1b1b
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:56:02 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:56:02 2015 -0800
----------------------------------------------------------------------
include/mesos/authentication/authenticatee.hpp | 56 ++++++++++++++++++
include/mesos/authentication/authenticator.hpp | 58 +++++++++++++++++++
include/mesos/module/authenticatee.hpp | 64 +++++++++++++++++++++
include/mesos/module/authenticator.hpp | 64 +++++++++++++++++++++
src/Makefile.am | 10 ++--
src/authentication/authenticatee.hpp | 58 -------------------
src/authentication/authenticator.hpp | 57 ------------------
src/authentication/cram_md5/authenticatee.hpp | 3 +-
src/authentication/cram_md5/authenticator.hpp | 4 +-
src/examples/test_authentication_modules.cpp | 10 ++--
src/master/master.cpp | 6 +-
src/master/master.hpp | 3 +-
src/module/authenticatee.hpp | 64 ---------------------
src/module/authenticator.hpp | 64 ---------------------
src/sched/sched.cpp | 6 +-
src/scheduler/scheduler.cpp | 5 +-
src/slave/slave.cpp | 3 +-
src/slave/slave.hpp | 4 +-
src/tests/cram_md5_authentication_tests.cpp | 12 ++--
19 files changed, 280 insertions(+), 271 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/include/mesos/authentication/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/authentication/authenticatee.hpp b/include/mesos/authentication/authenticatee.hpp
new file mode 100644
index 0000000..17fb7aa
--- /dev/null
+++ b/include/mesos/authentication/authenticatee.hpp
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_AUTHENTICATION_AUTHENTICATEE_HPP__
+#define __MESOS_AUTHENTICATION_AUTHENTICATEE_HPP__
+
+#include <mesos/mesos.hpp>
+
+#include <mesos/authentication/authentication.hpp>
+
+#include <process/future.hpp>
+#include <process/pid.hpp>
+
+namespace mesos {
+
+class Authenticatee
+{
+public:
+ Authenticatee() {}
+
+ virtual ~Authenticatee() {}
+
+ // 'pid' is the process to authenticate against (master).
+ // 'client' is the process to be authenticated (slave / framework).
+ // 'credential' is used to authenticate the 'client'.
+ // Returns true if successfully authenticated otherwise false or an
+ // error. Note that we distinguish authentication failure (false)
+ // from a failed future in the event the future failed due to a
+ // transient error and authentication can (should) be
+ // retried. Discarding the future will cause the future to fail if
+ // it hasn't already completed since we have already started the
+ // authentication procedure and can't reliably cancel.
+ virtual process::Future<bool> authenticate(
+ const process::UPID& pid,
+ const process::UPID& client,
+ const mesos::Credential& credential) = 0;
+};
+
+} // namespace mesos {
+
+#endif // __MESOS_AUTHENTICATION_AUTHENTICATEE_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/include/mesos/authentication/authenticator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/authentication/authenticator.hpp b/include/mesos/authentication/authenticator.hpp
new file mode 100644
index 0000000..f66217a
--- /dev/null
+++ b/include/mesos/authentication/authenticator.hpp
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_AUTHENTICATION_AUTHENTICATOR_HPP__
+#define __MESOS_AUTHENTICATION_AUTHENTICATOR_HPP__
+
+#include <string>
+
+#include <mesos/mesos.hpp>
+
+#include <mesos/authentication/authentication.hpp>
+
+#include <process/future.hpp>
+#include <process/pid.hpp>
+
+#include <stout/option.hpp>
+
+namespace mesos {
+
+// Note that this interface definition is not hardened yet and will
+// slightly change within the next release. See MESOS-2050.
+class Authenticator
+{
+public:
+ Authenticator() {}
+ virtual ~Authenticator() {}
+
+ virtual void initialize(const process::UPID& clientPid) = 0;
+
+ // Returns the principal of the Authenticatee if successfully
+ // authenticated otherwise None or an error. Note that we
+ // distinguish authentication failure (None) from a failed future
+ // in the event the future failed due to a transient error and
+ // authentication can (should) be retried. Discarding the future
+ // will cause the future to fail if it hasn't already completed
+ // since we have already started the authentication procedure and
+ // can't reliably cancel.
+ virtual process::Future<Option<std::string>> authenticate(void) = 0;
+};
+
+} // namespace mesos {
+
+#endif // __MESOS_AUTHENTICATION_AUTHENTICATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/include/mesos/module/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/authenticatee.hpp b/include/mesos/module/authenticatee.hpp
new file mode 100644
index 0000000..94de988
--- /dev/null
+++ b/include/mesos/module/authenticatee.hpp
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_MODULE_AUTHENTICATEE_HPP__
+#define __MESOS_MODULE_AUTHENTICATEE_HPP__
+
+#include <mesos/module.hpp>
+
+#include <mesos/authentication/authenticatee.hpp>
+
+namespace mesos {
+namespace modules {
+
+template<>
+inline const char* kind<mesos::Authenticatee>()
+{
+ return "Authenticatee";
+}
+
+
+template <>
+struct Module<mesos::Authenticatee> : ModuleBase
+{
+ Module(
+ const char* _moduleApiVersion,
+ const char* _mesosVersion,
+ const char* _authorName,
+ const char* _authorEmail,
+ const char* _description,
+ bool (*_compatible)(),
+ mesos::Authenticatee* (*_create)(const Parameters& parameters))
+ : ModuleBase(
+ _moduleApiVersion,
+ _mesosVersion,
+ mesos::modules::kind<mesos::Authenticatee>(),
+ _authorName,
+ _authorEmail,
+ _description,
+ _compatible),
+ create(_create)
+ { }
+
+ mesos::Authenticatee* (*create)(const Parameters& parameters);
+};
+
+} // namespace modules {
+} // namespace mesos {
+
+#endif // __MESOS_MODULE_AUTHENTICATEE_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/include/mesos/module/authenticator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/authenticator.hpp b/include/mesos/module/authenticator.hpp
new file mode 100644
index 0000000..6a83f17
--- /dev/null
+++ b/include/mesos/module/authenticator.hpp
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_MODULE_AUTHENTICATOR_HPP__
+#define __MESOS_MODULE_AUTHENTICATOR_HPP__
+
+#include <mesos/module.hpp>
+
+#include <mesos/authentication/authenticator.hpp>
+
+namespace mesos {
+namespace modules {
+
+template<>
+inline const char* kind<mesos::Authenticator>()
+{
+ return "Authenticator";
+}
+
+
+template <>
+struct Module<mesos::Authenticator> : ModuleBase
+{
+ Module(
+ const char* _moduleApiVersion,
+ const char* _mesosVersion,
+ const char* _authorName,
+ const char* _authorEmail,
+ const char* _description,
+ bool (*_compatible)(),
+ mesos::Authenticator* (*_create)(const Parameters& parameters))
+ : ModuleBase(
+ _moduleApiVersion,
+ _mesosVersion,
+ mesos::modules::kind<mesos::Authenticator>(),
+ _authorName,
+ _authorEmail,
+ _description,
+ _compatible),
+ create(_create)
+ { }
+
+ mesos::Authenticator* (*create)(const Parameters& parameters);
+};
+
+} // namespace modules {
+} // namespace mesos {
+
+#endif // __MESOS_MODULE_AUTHENTICATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a225321..7e40388 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -370,8 +370,10 @@ nodist_pkginclude_HEADERS = \
authenticationdir = $(pkgincludedir)/authentication
authentication_HEADERS = \
+ $(top_srcdir)/include/mesos/authentication/authenticatee.hpp \
$(top_srcdir)/include/mesos/authentication/authentication.hpp \
- $(top_srcdir)/include/mesos/authentication/authentication.proto
+ $(top_srcdir)/include/mesos/authentication/authentication.proto \
+ $(top_srcdir)/include/mesos/authentication/authenticator.hpp
nodist_authentication_HEADERS = ../include/mesos/authentication/authentication.pb.h
@@ -394,6 +396,8 @@ nodist_fetcher_HEADERS = ../include/mesos/fetcher/fetcher.pb.h
moduledir = $(pkgincludedir)/module
module_HEADERS = \
+ $(top_srcdir)/include/mesos/module/authenticatee.hpp \
+ $(top_srcdir)/include/mesos/module/authenticator.hpp \
$(top_srcdir)/include/mesos/module/isolator.hpp \
$(top_srcdir)/include/mesos/module/module.hpp \
$(top_srcdir)/include/mesos/module/module.proto
@@ -465,8 +469,6 @@ if WITH_NETWORK_ISOLATOR
endif
libmesos_no_3rdparty_la_SOURCES += \
- authentication/authenticatee.hpp \
- authentication/authenticator.hpp \
authentication/cram_md5/authenticatee.hpp \
authentication/cram_md5/authenticator.hpp \
authentication/cram_md5/auxprop.hpp \
@@ -510,8 +512,6 @@ libmesos_no_3rdparty_la_SOURCES += \
master/sorter.hpp \
master/validation.hpp \
messages/messages.hpp \
- module/authenticatee.hpp \
- module/authenticator.hpp \
module/hook.hpp \
module/manager.hpp \
sched/constants.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/authentication/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/authenticatee.hpp b/src/authentication/authenticatee.hpp
deleted file mode 100644
index ba90b3b..0000000
--- a/src/authentication/authenticatee.hpp
+++ /dev/null
@@ -1,58 +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.
- */
-
-#ifndef __AUTHENTICATEE_HPP__
-#define __AUTHENTICATEE_HPP__
-
-#include <mesos/mesos.hpp>
-
-#include <mesos/authentication/authentication.hpp>
-
-#include <process/future.hpp>
-
-#include <stout/nothing.hpp>
-#include <stout/try.hpp>
-
-namespace mesos {
-
-class Authenticatee
-{
-public:
- Authenticatee() {}
-
- virtual ~Authenticatee() {}
-
- // 'pid' is the process to authenticate against (master).
- // 'client' is the process to be authenticated (slave / framework).
- // 'credential' is used to authenticate the 'client'.
- // Returns true if successfully authenticated otherwise false or an
- // error. Note that we distinguish authentication failure (false)
- // from a failed future in the event the future failed due to a
- // transient error and authentication can (should) be
- // retried. Discarding the future will cause the future to fail if
- // it hasn't already completed since we have already started the
- // authentication procedure and can't reliably cancel.
- virtual process::Future<bool> authenticate(
- const process::UPID& pid,
- const process::UPID& client,
- const mesos::Credential& credential) = 0;
-};
-
-} // namespace mesos {
-
-#endif // __AUTHENTICATEE_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/authentication/authenticator.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/authenticator.hpp b/src/authentication/authenticator.hpp
deleted file mode 100644
index 5b1375f..0000000
--- a/src/authentication/authenticator.hpp
+++ /dev/null
@@ -1,57 +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.
- */
-
-#ifndef __AUTHENTICATOR_HPP__
-#define __AUTHENTICATOR_HPP__
-
-#include <mesos/mesos.hpp>
-
-#include <mesos/authentication/authentication.hpp>
-
-#include <process/future.hpp>
-#include <process/pid.hpp>
-
-#include <stout/nothing.hpp>
-#include <stout/try.hpp>
-
-namespace mesos {
-
-// Note that this interface definition is not hardened yet and will
-// slightly change within the next release. See MESOS-2050.
-class Authenticator
-{
-public:
- Authenticator() {}
- virtual ~Authenticator() {}
-
- virtual void initialize(const process::UPID& clientPid) = 0;
-
- // Returns the principal of the Authenticatee if successfully
- // authenticated otherwise None or an error. Note that we
- // distinguish authentication failure (None) from a failed future
- // in the event the future failed due to a transient error and
- // authentication can (should) be retried. Discarding the future
- // will cause the future to fail if it hasn't already completed
- // since we have already started the authentication procedure and
- // can't reliably cancel.
- virtual process::Future<Option<std::string>> authenticate(void) = 0;
-};
-
-} // namespace mesos {
-
-#endif // __AUTHENTICATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/authentication/cram_md5/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/authenticatee.hpp b/src/authentication/cram_md5/authenticatee.hpp
index 70e1509..3311916 100644
--- a/src/authentication/cram_md5/authenticatee.hpp
+++ b/src/authentication/cram_md5/authenticatee.hpp
@@ -27,6 +27,8 @@
#include <mesos/mesos.hpp>
+#include <mesos/module/authenticatee.hpp>
+
#include <process/defer.hpp>
#include <process/future.hpp>
#include <process/id.hpp>
@@ -36,7 +38,6 @@
#include <stout/strings.hpp>
-#include "authentication/authenticatee.hpp"
#include "messages/messages.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/authentication/cram_md5/authenticator.hpp
----------------------------------------------------------------------
diff --git a/src/authentication/cram_md5/authenticator.hpp b/src/authentication/cram_md5/authenticator.hpp
index fa34f76..7578ea1 100644
--- a/src/authentication/cram_md5/authenticator.hpp
+++ b/src/authentication/cram_md5/authenticator.hpp
@@ -27,6 +27,8 @@
#include <mesos/mesos.hpp>
+#include <mesos/module/authenticator.hpp>
+
#include <process/defer.hpp>
#include <process/future.hpp>
#include <process/id.hpp>
@@ -36,8 +38,6 @@
#include <stout/check.hpp>
-#include "authentication/authenticator.hpp"
-
#include "authentication/cram_md5/auxprop.hpp"
#include "messages/messages.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/examples/test_authentication_modules.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_authentication_modules.cpp b/src/examples/test_authentication_modules.cpp
index fd59fe4..5ff58d2 100644
--- a/src/examples/test_authentication_modules.cpp
+++ b/src/examples/test_authentication_modules.cpp
@@ -19,15 +19,15 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
-#include "authentication/authenticatee.hpp"
-#include "authentication/authenticator.hpp"
+#include <mesos/authentication/authenticatee.hpp>
+#include <mesos/authentication/authenticator.hpp>
+
+#include <mesos/module/authenticatee.hpp>
+#include <mesos/module/authenticator.hpp>
#include "authentication/cram_md5/authenticatee.hpp"
#include "authentication/cram_md5/authenticator.hpp"
-#include "module/authenticatee.hpp"
-#include "module/authenticator.hpp"
-
using namespace mesos;
using mesos::Authenticatee;
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 68bd6f5..6affd24 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -27,6 +27,10 @@
#include <mesos/module.hpp>
+#include <mesos/authentication/authenticator.hpp>
+
+#include <mesos/module/authenticator.hpp>
+
#include <process/check.hpp>
#include <process/collect.hpp>
#include <process/defer.hpp>
@@ -53,7 +57,6 @@
#include <stout/utils.hpp>
#include <stout/uuid.hpp>
-#include "authentication/authenticator.hpp"
#include "authentication/cram_md5/authenticator.hpp"
#include "authorizer/authorizer.hpp"
@@ -74,7 +77,6 @@
#include "master/flags.hpp"
#include "master/master.hpp"
-#include "module/authenticator.hpp"
#include "module/manager.hpp"
#include "watcher/whitelist_watcher.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 4f934c0..9433b0c 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -32,6 +32,8 @@
#include <mesos/scheduler.hpp>
#include <mesos/type_utils.hpp>
+#include <mesos/module/authenticator.hpp>
+
#include <process/http.hpp>
#include <process/owned.hpp>
#include <process/process.hpp>
@@ -71,7 +73,6 @@ namespace registry {
class Slaves;
}
-class Authenticator;
class Authorizer;
class WhitelistWatcher;
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/module/authenticatee.hpp
----------------------------------------------------------------------
diff --git a/src/module/authenticatee.hpp b/src/module/authenticatee.hpp
deleted file mode 100644
index a53016a..0000000
--- a/src/module/authenticatee.hpp
+++ /dev/null
@@ -1,64 +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.
- */
-
-#ifndef __MODULE_AUTHENTICATEE_HPP__
-#define __MODULE_AUTHENTICATEE_HPP__
-
-#include <mesos/module.hpp>
-
-#include "authentication/authenticatee.hpp"
-
-namespace mesos {
-namespace modules {
-
-template<>
-inline const char* kind<mesos::Authenticatee>()
-{
- return "Authenticatee";
-}
-
-
-template <>
-struct Module<mesos::Authenticatee> : ModuleBase
-{
- Module(
- const char* _moduleApiVersion,
- const char* _mesosVersion,
- const char* _authorName,
- const char* _authorEmail,
- const char* _description,
- bool (*_compatible)(),
- mesos::Authenticatee* (*_create)(const Parameters& parameters))
- : ModuleBase(
- _moduleApiVersion,
- _mesosVersion,
- mesos::modules::kind<mesos::Authenticatee>(),
- _authorName,
- _authorEmail,
- _description,
- _compatible),
- create(_create)
- { }
-
- mesos::Authenticatee* (*create)(const Parameters& parameters);
-};
-
-} // namespace modules {
-} // namespace mesos {
-
-#endif // __MODULE_AUTHENTICATEE_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/module/authenticator.hpp
----------------------------------------------------------------------
diff --git a/src/module/authenticator.hpp b/src/module/authenticator.hpp
deleted file mode 100644
index 156617b..0000000
--- a/src/module/authenticator.hpp
+++ /dev/null
@@ -1,64 +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.
- */
-
-#ifndef __MODULE_AUTHENTICATOR_HPP__
-#define __MODULE_AUTHENTICATOR_HPP__
-
-#include <mesos/module.hpp>
-
-#include "authentication/authenticator.hpp"
-
-namespace mesos {
-namespace modules {
-
-template<>
-inline const char* kind<mesos::Authenticator>()
-{
- return "Authenticator";
-}
-
-
-template <>
-struct Module<mesos::Authenticator> : ModuleBase
-{
- Module(
- const char* _moduleApiVersion,
- const char* _mesosVersion,
- const char* _authorName,
- const char* _authorEmail,
- const char* _description,
- bool (*_compatible)(),
- mesos::Authenticator* (*_create)(const Parameters& parameters))
- : ModuleBase(
- _moduleApiVersion,
- _mesosVersion,
- mesos::modules::kind<mesos::Authenticator>(),
- _authorName,
- _authorEmail,
- _description,
- _compatible),
- create(_create)
- { }
-
- mesos::Authenticator* (*create)(const Parameters& parameters);
-};
-
-} // namespace modules {
-} // namespace mesos {
-
-#endif // __MODULE_AUTHENTICATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 03d1d13..ea7e447 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -35,6 +35,10 @@
#include <mesos/scheduler.hpp>
#include <mesos/type_utils.hpp>
+#include <mesos/authentication/authenticatee.hpp>
+
+#include <mesos/module/authenticatee.hpp>
+
#include <mesos/scheduler/scheduler.hpp>
#include <process/defer.hpp>
@@ -63,7 +67,6 @@
#include <stout/utils.hpp>
#include <stout/uuid.hpp>
-#include "authentication/authenticatee.hpp"
#include "authentication/cram_md5/authenticatee.hpp"
#include "common/lock.hpp"
@@ -78,7 +81,6 @@
#include "messages/messages.hpp"
-#include "module/authenticatee.hpp"
#include "module/manager.hpp"
#include "sched/constants.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index d4eb195..5816569 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -33,6 +33,10 @@
#include <mesos/scheduler.hpp>
#include <mesos/type_utils.hpp>
+#include <mesos/authentication/authenticatee.hpp>
+
+#include <mesos/module/authenticatee.hpp>
+
#include <process/async.hpp>
#include <process/defer.hpp>
#include <process/delay.hpp>
@@ -54,7 +58,6 @@
#include <stout/os.hpp>
#include <stout/uuid.hpp>
-#include "authentication/authenticatee.hpp"
#include "authentication/cram_md5/authenticatee.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index d18ac27..3eace81 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -31,6 +31,8 @@
#include <mesos/type_utils.hpp>
+#include <mesos/module/authenticatee.hpp>
+
#include <process/async.hpp>
#include <process/check.hpp>
#include <process/defer.hpp>
@@ -74,7 +76,6 @@
#include "logging/logging.hpp"
-#include "module/authenticatee.hpp"
#include "module/manager.hpp"
#include "slave/constants.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index abe4140..93fa4b5 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -30,6 +30,8 @@
#include <mesos/resources.hpp>
#include <mesos/type_utils.hpp>
+#include <mesos/module/authenticatee.hpp>
+
#include <process/http.hpp>
#include <process/future.hpp>
#include <process/owned.hpp>
@@ -67,8 +69,6 @@ namespace mesos {
class MasterDetector; // Forward declaration.
-class Authenticatee;
-
namespace slave {
using namespace process;
http://git-wip-us.apache.org/repos/asf/mesos/blob/dd3870c6/src/tests/cram_md5_authentication_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cram_md5_authentication_tests.cpp b/src/tests/cram_md5_authentication_tests.cpp
index 8b50413..dd102dc 100644
--- a/src/tests/cram_md5_authentication_tests.cpp
+++ b/src/tests/cram_md5_authentication_tests.cpp
@@ -18,6 +18,12 @@
#include <string>
+#include <mesos/authentication/authenticatee.hpp>
+#include <mesos/authentication/authenticator.hpp>
+
+#include <mesos/module/authenticatee.hpp>
+#include <mesos/module/authenticator.hpp>
+
#include <process/gmock.hpp>
#include <process/gtest.hpp>
#include <process/pid.hpp>
@@ -25,15 +31,9 @@
#include <stout/gtest.hpp>
-#include "authentication/authenticatee.hpp"
-#include "authentication/authenticator.hpp"
-
#include "authentication/cram_md5/authenticatee.hpp"
#include "authentication/cram_md5/authenticator.hpp"
-#include "module/authenticatee.hpp"
-#include "module/authenticator.hpp"
-
#include "tests/mesos.hpp"
#include "tests/module.hpp"
[9/9] mesos git commit: Out of tree build 9: Exposed Hook headers.
Posted by nn...@apache.org.
Out of tree build 9: Exposed Hook headers.
Moved hook/hook.hpp to include/mesos/ and module/hook.hpp to
include/mesos/module.
Review: https://reviews.apache.org/r/30052
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c6361c55
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c6361c55
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c6361c55
Branch: refs/heads/master
Commit: c6361c556d1be54c7e320d65320aae20336c0f16
Parents: dd3870c
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:56:36 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:56:36 2015 -0800
----------------------------------------------------------------------
include/mesos/hook.hpp | 73 +++++++++++++++++++++++++++++++++
include/mesos/module/hook.hpp | 64 +++++++++++++++++++++++++++++
src/Makefile.am | 4 +-
src/examples/test_hook_module.cpp | 8 ++--
src/hook/hook.hpp | 74 ----------------------------------
src/hook/manager.cpp | 6 ++-
src/hook/manager.hpp | 5 +--
src/module/hook.hpp | 65 -----------------------------
8 files changed, 148 insertions(+), 151 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/include/mesos/hook.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/hook.hpp b/include/mesos/hook.hpp
new file mode 100644
index 0000000..d83ace5
--- /dev/null
+++ b/include/mesos/hook.hpp
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_HOOK_HPP__
+#define __MESOS_HOOK_HPP__
+
+#include <mesos/mesos.hpp>
+
+#include <stout/none.hpp>
+#include <stout/nothing.hpp>
+#include <stout/result.hpp>
+#include <stout/try.hpp>
+
+namespace mesos {
+
+class Hook
+{
+public:
+ virtual ~Hook() {};
+
+ // This label decorator hook is called from within master during
+ // the launchTask routine. A module implementing the hook creates
+ // and returns a set of labels. These labels are then merged with
+ // the task labels and passed on to the slave/executor.
+ virtual Result<Labels> masterLaunchTaskLabelDecorator(
+ const TaskInfo& taskInfo,
+ const FrameworkInfo& frameworkInfo,
+ const SlaveInfo& slaveInfo)
+ {
+ return None();
+ }
+
+ // This environment decorator hook is called from within slave
+ // when launching a new executor. A module implementing the hook
+ // creates and returns a set of environment variables. These
+ // environment variables are then merged into the executorInfo
+ // and become part of the executor's environment.
+ virtual Result<Environment> slaveLaunchExecutorEnvironmentDecorator(
+ const ExecutorInfo& executorInfo,
+ const TaskInfo& taskInfo)
+ {
+ return None();
+ }
+
+ // This hook is called from within slave when an executor is being
+ // removed. A typical module implementing the hook will perform
+ // some cleanup as required.
+ virtual Try<Nothing> slaveRemoveExecutorHook(
+ const FrameworkInfo& frameworkInfo,
+ const ExecutorInfo& executorInfo)
+ {
+ return Nothing();
+ }
+};
+
+} // namespace mesos {
+
+#endif // __MESOS_HOOK_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/include/mesos/module/hook.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/hook.hpp b/include/mesos/module/hook.hpp
new file mode 100644
index 0000000..a474e2b
--- /dev/null
+++ b/include/mesos/module/hook.hpp
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_MODULE_HOOK_HPP__
+#define __MESOS_MODULE_HOOK_HPP__
+
+#include <mesos/hook.hpp>
+#include <mesos/mesos.hpp>
+#include <mesos/module.hpp>
+
+namespace mesos {
+namespace modules {
+
+template<>
+inline const char* kind<mesos::Hook>()
+{
+ return "Hook";
+}
+
+
+template <>
+struct Module<mesos::Hook> : ModuleBase
+{
+ Module(
+ const char* _moduleApiVersion,
+ const char* _mesosVersion,
+ const char* _authorName,
+ const char* _authorEmail,
+ const char* _description,
+ bool (*_compatible)(),
+ mesos::Hook* (*_create)(const Parameters& parameters))
+ : ModuleBase(
+ _moduleApiVersion,
+ _mesosVersion,
+ mesos::modules::kind<mesos::Hook>(),
+ _authorName,
+ _authorEmail,
+ _description,
+ _compatible),
+ create(_create)
+ { }
+
+ mesos::Hook* (*create)(const Parameters& parameters);
+};
+
+} // namespace modules {
+} // namespace mesos {
+
+#endif // __MESOS_MODULE_HOOK_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e40388..fae36ac 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -355,6 +355,7 @@ libmesos_no_3rdparty_la_SOURCES = \
pkginclude_HEADERS = \
$(top_srcdir)/include/mesos/executor.hpp \
+ $(top_srcdir)/include/mesos/hook.hpp \
$(top_srcdir)/include/mesos/mesos.hpp \
$(top_srcdir)/include/mesos/module.hpp \
$(top_srcdir)/include/mesos/resources.hpp \
@@ -398,6 +399,7 @@ moduledir = $(pkgincludedir)/module
module_HEADERS = \
$(top_srcdir)/include/mesos/module/authenticatee.hpp \
$(top_srcdir)/include/mesos/module/authenticator.hpp \
+ $(top_srcdir)/include/mesos/module/hook.hpp \
$(top_srcdir)/include/mesos/module/isolator.hpp \
$(top_srcdir)/include/mesos/module/module.hpp \
$(top_srcdir)/include/mesos/module/module.proto
@@ -488,7 +490,6 @@ libmesos_no_3rdparty_la_SOURCES += \
examples/test_module.hpp \
files/files.hpp \
hdfs/hdfs.hpp \
- hook/hook.hpp \
hook/manager.hpp \
linux/cgroups.hpp \
linux/fs.hpp \
@@ -512,7 +513,6 @@ libmesos_no_3rdparty_la_SOURCES += \
master/sorter.hpp \
master/validation.hpp \
messages/messages.hpp \
- module/hook.hpp \
module/manager.hpp \
sched/constants.hpp \
sched/flags.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/examples/test_hook_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_hook_module.cpp b/src/examples/test_hook_module.cpp
index 573ccb3..8faf685 100644
--- a/src/examples/test_hook_module.cpp
+++ b/src/examples/test_hook_module.cpp
@@ -18,18 +18,16 @@
#include <string>
+#include <mesos/hook.hpp>
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
+#include <mesos/module/hook.hpp>
+
#include <stout/foreach.hpp>
#include <stout/os.hpp>
#include <stout/try.hpp>
-#include "hook/hook.hpp"
-#include "master/master.hpp"
-#include "module/hook.hpp"
-#include "slave/slave.hpp"
-
using std::string;
using namespace mesos;
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/hook/hook.hpp
----------------------------------------------------------------------
diff --git a/src/hook/hook.hpp b/src/hook/hook.hpp
deleted file mode 100644
index e31b7c9..0000000
--- a/src/hook/hook.hpp
+++ /dev/null
@@ -1,74 +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.
- */
-
-#ifndef __HOOK_HOOK_HPP__
-#define __HOOK_HOOK_HPP__
-
-#include <mesos/mesos.hpp>
-
-#include <stout/none.hpp>
-#include <stout/result.hpp>
-
-#include "master/master.hpp"
-#include "slave/slave.hpp"
-
-namespace mesos {
-
-class Hook
-{
-public:
- virtual ~Hook() {};
-
- // This label decorator hook is called from within master during
- // the launchTask routine. A module implementing the hook creates
- // and returns a set of labels. These labels are then merged with
- // the task labels and passed on to the slave/executor.
- virtual Result<Labels> masterLaunchTaskLabelDecorator(
- const TaskInfo& taskInfo,
- const FrameworkInfo& frameworkInfo,
- const SlaveInfo& slaveInfo)
- {
- return None();
- }
-
- // This environment decorator hook is called from within slave
- // when launching a new executor. A module implementing the hook
- // creates and returns a set of environment variables. These
- // environment variables are then merged into the executorInfo
- // and become part of the executor's environment.
- virtual Result<Environment> slaveLaunchExecutorEnvironmentDecorator(
- const ExecutorInfo& executorInfo,
- const TaskInfo& taskInfo)
- {
- return None();
- }
-
- // This hook is called from within slave when an executor is being
- // removed. A typical module implementing the hook will perform
- // some cleanup as required.
- virtual Try<Nothing> slaveRemoveExecutorHook(
- const FrameworkInfo& frameworkInfo,
- const ExecutorInfo& executorInfo)
- {
- return Nothing();
- }
-};
-
-} // namespace mesos {
-
-#endif // __HOOK_HOOK_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/hook/manager.cpp
----------------------------------------------------------------------
diff --git a/src/hook/manager.cpp b/src/hook/manager.cpp
index c14dcca..a6938d0 100644
--- a/src/hook/manager.cpp
+++ b/src/hook/manager.cpp
@@ -21,6 +21,10 @@
#include <string>
#include <vector>
+#include <mesos/hook.hpp>
+
+#include <mesos/module/hook.hpp>
+
#include <stout/check.hpp>
#include <stout/foreach.hpp>
#include <stout/nothing.hpp>
@@ -28,9 +32,7 @@
#include <stout/try.hpp>
#include "common/lock.hpp"
-#include "hook/hook.hpp"
#include "hook/manager.hpp"
-#include "module/hook.hpp"
#include "module/manager.hpp"
using std::string;
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/hook/manager.hpp
----------------------------------------------------------------------
diff --git a/src/hook/manager.hpp b/src/hook/manager.hpp
index 2de59b7..a6594c1 100644
--- a/src/hook/manager.hpp
+++ b/src/hook/manager.hpp
@@ -22,10 +22,9 @@
#include <string>
#include <mesos/mesos.hpp>
+#include <mesos/hook.hpp>
-#include "hook/hook.hpp"
-#include "master/master.hpp"
-#include "messages/messages.hpp"
+#include <stout/try.hpp>
namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c6361c55/src/module/hook.hpp
----------------------------------------------------------------------
diff --git a/src/module/hook.hpp b/src/module/hook.hpp
deleted file mode 100644
index c7edfba..0000000
--- a/src/module/hook.hpp
+++ /dev/null
@@ -1,65 +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.
- */
-
-#ifndef __MODULE_HOOK_HPP__
-#define __MODULE_HOOK_HPP__
-
-#include <mesos/mesos.hpp>
-#include <mesos/module.hpp>
-
-#include "hook/hook.hpp"
-
-namespace mesos {
-namespace modules {
-
-template<>
-inline const char* kind<mesos::Hook>()
-{
- return "Hook";
-}
-
-
-template <>
-struct Module<mesos::Hook> : ModuleBase
-{
- Module(
- const char* _moduleApiVersion,
- const char* _mesosVersion,
- const char* _authorName,
- const char* _authorEmail,
- const char* _description,
- bool (*_compatible)(),
- mesos::Hook* (*_create)(const Parameters& parameters))
- : ModuleBase(
- _moduleApiVersion,
- _mesosVersion,
- mesos::modules::kind<mesos::Hook>(),
- _authorName,
- _authorEmail,
- _description,
- _compatible),
- create(_create)
- { }
-
- mesos::Hook* (*create)(const Parameters& parameters);
-};
-
-} // namespace modules {
-} // namespace mesos {
-
-#endif // __MODULE_HOOK_HPP__
[4/9] mesos git commit: Out of tree build 4: Introduced
ExecutorRunState struct for Isolators and Launchers.
Posted by nn...@apache.org.
Out of tree build 4: Introduced ExecutorRunState struct for Isolators and Launchers.
The struct is constructed from some fields of RunState and passed on
to Isolators. This further allows us to do cleanup various
isolators/launchers. The goal was to remove the dependency on RunState
so that we can eventually expose slave/containerizer/isolator.hpp as a
public header.
Review: https://reviews.apache.org/r/30338
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/79a18e60
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/79a18e60
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/79a18e60
Branch: refs/heads/master
Commit: 79a18e60f81e9234f4d1d308030a9c815af89913
Parents: bcb01db
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:54:03 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:54:03 2015 -0800
----------------------------------------------------------------------
.../containerizer/external_containerizer.hpp | 2 ++
src/slave/containerizer/isolator.cpp | 2 +-
src/slave/containerizer/isolator.hpp | 21 ++++++++++++++----
.../isolators/cgroups/cpushare.cpp | 14 +++---------
.../isolators/cgroups/cpushare.hpp | 2 +-
.../containerizer/isolators/cgroups/mem.cpp | 14 +++---------
.../containerizer/isolators/cgroups/mem.hpp | 2 +-
.../isolators/cgroups/perf_event.cpp | 14 +++---------
.../isolators/cgroups/perf_event.hpp | 2 +-
.../isolators/filesystem/shared.cpp | 2 +-
.../isolators/filesystem/shared.hpp | 2 +-
.../containerizer/isolators/namespaces/pid.cpp | 11 +++-------
.../containerizer/isolators/namespaces/pid.hpp | 2 +-
.../isolators/network/port_mapping.cpp | 22 ++++---------------
.../isolators/network/port_mapping.hpp | 2 +-
src/slave/containerizer/isolators/posix.hpp | 18 +++++----------
.../containerizer/isolators/posix/disk.cpp | 16 +++-----------
.../containerizer/isolators/posix/disk.hpp | 2 +-
src/slave/containerizer/launcher.cpp | 21 +++++-------------
src/slave/containerizer/launcher.hpp | 7 +++---
src/slave/containerizer/linux_launcher.cpp | 19 +++++-----------
src/slave/containerizer/linux_launcher.hpp | 2 +-
src/slave/containerizer/mesos/containerizer.cpp | 23 +++++++++++---------
src/slave/containerizer/mesos/containerizer.hpp | 6 +++--
src/tests/isolator.hpp | 2 +-
25 files changed, 86 insertions(+), 144 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/external_containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.hpp b/src/slave/containerizer/external_containerizer.hpp
index 1296878..d7ae6d6 100644
--- a/src/slave/containerizer/external_containerizer.hpp
+++ b/src/slave/containerizer/external_containerizer.hpp
@@ -31,6 +31,8 @@
#include <stout/try.hpp>
#include <stout/tuple.hpp>
+#include "slave/state.hpp"
+
#include "slave/containerizer/containerizer.hpp"
#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolator.cpp b/src/slave/containerizer/isolator.cpp
index bb4da46..9f5ba99 100644
--- a/src/slave/containerizer/isolator.cpp
+++ b/src/slave/containerizer/isolator.cpp
@@ -43,7 +43,7 @@ Isolator::~Isolator()
}
-Future<Nothing> Isolator::recover(const list<state::RunState>& state)
+Future<Nothing> Isolator::recover(const list<ExecutorRunState>& state)
{
return dispatch(process.get(), &IsolatorProcess::recover, state);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolator.hpp b/src/slave/containerizer/isolator.hpp
index e39a8a5..0823f4a 100644
--- a/src/slave/containerizer/isolator.hpp
+++ b/src/slave/containerizer/isolator.hpp
@@ -31,8 +31,6 @@
#include <stout/try.hpp>
-#include "slave/state.hpp"
-
namespace mesos {
namespace slave {
@@ -61,6 +59,21 @@ struct Limitation
};
+// This struct is derived from slave::state::RunState. It contains
+// only those fields that are needed by Isolators for recovering the
+// containers. The reason for not using RunState instead is to avoid
+// any dependency on RunState and in turn on internal protobufs.
+struct ExecutorRunState
+{
+ ExecutorRunState(ContainerID id_, pid_t pid_, std::string directory_)
+ : id(id_), pid(pid_), directory(directory_) {}
+
+ ContainerID id; // Container id of the last executor run.
+ pid_t pid; // Executor pid.
+ std::string directory; // Executor work directory.
+};
+
+
class Isolator
{
public:
@@ -69,7 +82,7 @@ public:
// Recover containers from the run states.
process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
// Prepare for isolation of the executor. Any steps that require execution in
// the containerized context (e.g. inside a network namespace) can be
@@ -118,7 +131,7 @@ public:
virtual ~IsolatorProcess() {}
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& state) = 0;
+ const std::list<ExecutorRunState>& state) = 0;
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/cpushare.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/cpushare.cpp b/src/slave/containerizer/isolators/cgroups/cpushare.cpp
index 91e3a01..e724b12 100644
--- a/src/slave/containerizer/isolators/cgroups/cpushare.cpp
+++ b/src/slave/containerizer/isolators/cgroups/cpushare.cpp
@@ -167,20 +167,12 @@ Try<Isolator*> CgroupsCpushareIsolatorProcess::create(const Flags& flags)
Future<Nothing> CgroupsCpushareIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
hashset<string> cgroups;
- foreach (const state::RunState& state, states) {
- if (!state.id.isSome()) {
- foreachvalue (Info* info, infos) {
- delete info;
- }
- infos.clear();
- return Failure("ContainerID is required to recover");
- }
-
- const ContainerID& containerId = state.id.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
const string cgroup = path::join(flags.cgroups_root, containerId.value());
Try<bool> exists = cgroups::exists(hierarchies["cpu"], cgroup);
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/cpushare.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/cpushare.hpp b/src/slave/containerizer/isolators/cgroups/cpushare.hpp
index 1050af7..6c6c57d 100644
--- a/src/slave/containerizer/isolators/cgroups/cpushare.hpp
+++ b/src/slave/containerizer/isolators/cgroups/cpushare.hpp
@@ -44,7 +44,7 @@ public:
virtual ~CgroupsCpushareIsolatorProcess();
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/mem.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/mem.cpp b/src/slave/containerizer/isolators/cgroups/mem.cpp
index 276aa2b..c022127 100644
--- a/src/slave/containerizer/isolators/cgroups/mem.cpp
+++ b/src/slave/containerizer/isolators/cgroups/mem.cpp
@@ -130,20 +130,12 @@ Try<Isolator*> CgroupsMemIsolatorProcess::create(const Flags& flags)
Future<Nothing> CgroupsMemIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
hashset<string> cgroups;
- foreach (const state::RunState& state, states) {
- if (state.id.isNone()) {
- foreachvalue (Info* info, infos) {
- delete info;
- }
- infos.clear();
- return Failure("ContainerID is required to recover");
- }
-
- const ContainerID& containerId = state.id.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
const string cgroup = path::join(flags.cgroups_root, containerId.value());
Try<bool> exists = cgroups::exists(hierarchy, cgroup);
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/mem.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/mem.hpp b/src/slave/containerizer/isolators/cgroups/mem.hpp
index 4de5c64..c3793c4 100644
--- a/src/slave/containerizer/isolators/cgroups/mem.hpp
+++ b/src/slave/containerizer/isolators/cgroups/mem.hpp
@@ -38,7 +38,7 @@ public:
virtual ~CgroupsMemIsolatorProcess();
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/perf_event.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/perf_event.cpp b/src/slave/containerizer/isolators/cgroups/perf_event.cpp
index f94eeae..331a10b 100644
--- a/src/slave/containerizer/isolators/cgroups/perf_event.cpp
+++ b/src/slave/containerizer/isolators/cgroups/perf_event.cpp
@@ -137,20 +137,12 @@ void CgroupsPerfEventIsolatorProcess::initialize()
Future<Nothing> CgroupsPerfEventIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
hashset<string> cgroups;
- foreach (const state::RunState& state, states) {
- if (state.id.isNone()) {
- foreachvalue (Info* info, infos) {
- delete info;
- }
- infos.clear();
- return Failure("ContainerID is required to recover");
- }
-
- const ContainerID& containerId = state.id.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
const string cgroup = path::join(flags.cgroups_root, containerId.value());
Try<bool> exists = cgroups::exists(hierarchy, cgroup);
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/cgroups/perf_event.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/cgroups/perf_event.hpp b/src/slave/containerizer/isolators/cgroups/perf_event.hpp
index 6bf8858..a546697 100644
--- a/src/slave/containerizer/isolators/cgroups/perf_event.hpp
+++ b/src/slave/containerizer/isolators/cgroups/perf_event.hpp
@@ -42,7 +42,7 @@ public:
virtual ~CgroupsPerfEventIsolatorProcess();
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/filesystem/shared.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/filesystem/shared.cpp b/src/slave/containerizer/isolators/filesystem/shared.cpp
index 85a5ade..cfd1e96 100644
--- a/src/slave/containerizer/isolators/filesystem/shared.cpp
+++ b/src/slave/containerizer/isolators/filesystem/shared.cpp
@@ -57,7 +57,7 @@ Try<Isolator*> SharedFilesystemIsolatorProcess::create(const Flags& flags)
Future<Nothing> SharedFilesystemIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
// There is nothing to recover because we do not keep any state and
// do not monitor filesystem usage or perform any action on cleanup.
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/filesystem/shared.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/filesystem/shared.hpp b/src/slave/containerizer/isolators/filesystem/shared.hpp
index a5b5ca1..27c7a65 100644
--- a/src/slave/containerizer/isolators/filesystem/shared.hpp
+++ b/src/slave/containerizer/isolators/filesystem/shared.hpp
@@ -39,7 +39,7 @@ public:
virtual ~SharedFilesystemIsolatorProcess();
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/namespaces/pid.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/namespaces/pid.cpp b/src/slave/containerizer/isolators/namespaces/pid.cpp
index 0ad102d..ae52404 100644
--- a/src/slave/containerizer/isolators/namespaces/pid.cpp
+++ b/src/slave/containerizer/isolators/namespaces/pid.cpp
@@ -118,17 +118,12 @@ Result<ino_t> NamespacesPidIsolatorProcess::getNamespace(
Future<Nothing> NamespacesPidIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
hashset<ContainerID> containers;
- foreach (const state::RunState& state, states)
- {
- if (!state.id.isSome()) {
- return Failure("ContainerID required to recover");
- }
-
- containers.insert(state.id.get());
+ foreach (const ExecutorRunState& state, states) {
+ containers.insert(state.id);
}
// Clean up any orphaned bind mounts and empty files.
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/namespaces/pid.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/namespaces/pid.hpp b/src/slave/containerizer/isolators/namespaces/pid.hpp
index 7052a03..21674ce 100644
--- a/src/slave/containerizer/isolators/namespaces/pid.hpp
+++ b/src/slave/containerizer/isolators/namespaces/pid.hpp
@@ -56,7 +56,7 @@ public:
virtual ~NamespacesPidIsolatorProcess() {}
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/network/port_mapping.cpp b/src/slave/containerizer/isolators/network/port_mapping.cpp
index 361e33b..b860b17 100644
--- a/src/slave/containerizer/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/isolators/network/port_mapping.cpp
@@ -1314,7 +1314,7 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags& flags)
Future<Nothing> PortMappingIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
// Extract pids from virtual device names.
Try<set<string> > links = net::links();
@@ -1337,23 +1337,9 @@ Future<Nothing> PortMappingIsolatorProcess::recover(
pids.insert(pid.get());
}
- foreach (const state::RunState& state, states) {
- if (!state.id.isSome()) {
- foreachvalue (Info* info, infos) {
- delete info;
- }
- infos.clear();
- unmanaged.clear();
-
- return Failure("ContainerID and pid are required to recover");
- }
-
- // Containerizer is not supposed to let the isolator recover a run
- // with a forked pid.
- CHECK_SOME(state.forkedPid);
-
- const ContainerID& containerId = state.id.get();
- pid_t pid = state.forkedPid.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
+ pid_t pid = state.pid;
VLOG(1) << "Recovering network isolator for container "
<< containerId << " with pid " << pid;
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/network/port_mapping.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/network/port_mapping.hpp b/src/slave/containerizer/isolators/network/port_mapping.hpp
index 1e4ed3d..a74bd65 100644
--- a/src/slave/containerizer/isolators/network/port_mapping.hpp
+++ b/src/slave/containerizer/isolators/network/port_mapping.hpp
@@ -129,7 +129,7 @@ public:
virtual ~PortMappingIsolatorProcess() {}
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/posix.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix.hpp b/src/slave/containerizer/isolators/posix.hpp
index b6d289b..0d59384 100644
--- a/src/slave/containerizer/isolators/posix.hpp
+++ b/src/slave/containerizer/isolators/posix.hpp
@@ -41,28 +41,20 @@ class PosixIsolatorProcess : public IsolatorProcess
{
public:
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& state)
+ const std::list<ExecutorRunState>& state)
{
- foreach (const state::RunState& run, state) {
- if (!run.id.isSome()) {
- return process::Failure("ContainerID is required to recover");
- }
-
- if (!run.forkedPid.isSome()) {
- return process::Failure("Executor pid is required to recover");
- }
-
+ foreach (const ExecutorRunState& run, state) {
// This should (almost) never occur: see comment in
// PosixLauncher::recover().
- if (pids.contains(run.id.get())) {
+ if (pids.contains(run.id)) {
return process::Failure("Container already recovered");
}
- pids.put(run.id.get(), run.forkedPid.get());
+ pids.put(run.id, run.pid);
process::Owned<process::Promise<Limitation> > promise(
new process::Promise<Limitation>());
- promises.put(run.id.get(), promise);
+ promises.put(run.id, promise);
}
return Nothing();
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/posix/disk.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix/disk.cpp b/src/slave/containerizer/isolators/posix/disk.cpp
index b2be552..ee53063 100644
--- a/src/slave/containerizer/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/isolators/posix/disk.cpp
@@ -76,25 +76,15 @@ PosixDiskIsolatorProcess::~PosixDiskIsolatorProcess() {}
Future<Nothing> PosixDiskIsolatorProcess::recover(
- const list<state::RunState>& states)
+ const list<ExecutorRunState>& states)
{
- foreach (const state::RunState& state, states) {
- if (state.id.isNone()) {
- infos.clear();
-
- return Failure("ContainerID is required for recovery");
- }
-
- if (state.completed) {
- continue;
- }
-
+ foreach (const ExecutorRunState& state, states) {
// Since we checkpoint the executor after we create its working
// directory, the working directory should definitely exist.
CHECK(os::exists(state.directory))
<< "Executor work directory " << state.directory << " doesn't exist";
- infos.put(state.id.get(), Owned<Info>(new Info(state.directory)));
+ infos.put(state.id, Owned<Info>(new Info(state.directory)));
}
return Nothing();
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/isolators/posix/disk.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/posix/disk.hpp b/src/slave/containerizer/isolators/posix/disk.hpp
index 58a06c7..4760d06 100644
--- a/src/slave/containerizer/isolators/posix/disk.hpp
+++ b/src/slave/containerizer/isolators/posix/disk.hpp
@@ -76,7 +76,7 @@ public:
virtual ~PosixDiskIsolatorProcess();
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual process::Future<Option<CommandInfo>> prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/launcher.cpp b/src/slave/containerizer/launcher.cpp
index f2267ad..f413a51 100644
--- a/src/slave/containerizer/launcher.cpp
+++ b/src/slave/containerizer/launcher.cpp
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <mesos/type_utils.hpp>
+
#include <process/collect.hpp>
#include <process/delay.hpp>
#include <process/process.hpp>
@@ -37,8 +39,6 @@ using std::vector;
namespace mesos {
namespace slave {
-using state::RunState;
-
Try<Launcher*> PosixLauncher::create(const Flags& flags)
{
@@ -46,20 +46,11 @@ Try<Launcher*> PosixLauncher::create(const Flags& flags)
}
-Future<Nothing> PosixLauncher::recover(const list<RunState>& states)
+Future<Nothing> PosixLauncher::recover(const list<ExecutorRunState>& states)
{
- foreach (const RunState& state, states) {
- if (state.id.isNone()) {
- return Failure("ContainerID is required to recover");
- }
-
- const ContainerID& containerId = state.id.get();
-
- if (state.forkedPid.isNone()) {
- return Failure("Executor pid is required to recover container " +
- stringify(containerId));
- }
- pid_t pid = state.forkedPid.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
+ pid_t pid = state.pid;
if (pids.containsValue(pid)) {
// This should (almost) never occur. There is the possibility
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/launcher.hpp b/src/slave/containerizer/launcher.hpp
index b6fab38..75ade8b 100644
--- a/src/slave/containerizer/launcher.hpp
+++ b/src/slave/containerizer/launcher.hpp
@@ -32,7 +32,8 @@
#include <stout/try.hpp>
#include "slave/flags.hpp"
-#include "slave/state.hpp"
+
+#include "slave/containerizer/isolator.hpp"
namespace mesos {
namespace slave {
@@ -44,7 +45,7 @@ public:
// Recover the necessary state for each container listed in state.
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states) = 0;
+ const std::list<ExecutorRunState>& states) = 0;
// Fork a new process in the containerized context. The child will
// exec the binary at the given path with the given argv, flags and
@@ -81,7 +82,7 @@ public:
virtual ~PosixLauncher() {}
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual Try<pid_t> fork(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/linux_launcher.cpp b/src/slave/containerizer/linux_launcher.cpp
index 8417160..3fdfb57 100644
--- a/src/slave/containerizer/linux_launcher.cpp
+++ b/src/slave/containerizer/linux_launcher.cpp
@@ -50,8 +50,6 @@ using std::vector;
namespace mesos {
namespace slave {
-using state::RunState;
-
LinuxLauncher::LinuxLauncher(
const Flags& _flags,
int _namespaces,
@@ -124,21 +122,14 @@ Future<Nothing> _recover(const Future<list<Nothing> >& futures)
}
-Future<Nothing> LinuxLauncher::recover(const std::list<state::RunState>& states)
+Future<Nothing> LinuxLauncher::recover(
+ const std::list<ExecutorRunState>& states)
{
hashset<string> cgroups;
- foreach (const RunState& state, states) {
- if (state.id.isNone()) {
- return Failure("ContainerID is required to recover");
- }
- const ContainerID& containerId = state.id.get();
-
- if (state.forkedPid.isNone()) {
- return Failure("Executor pid is required to recover container " +
- stringify(containerId));
- }
- pid_t pid = state.forkedPid.get();
+ foreach (const ExecutorRunState& state, states) {
+ const ContainerID& containerId = state.id;
+ pid_t pid = state.pid;
if (pids.containsValue(pid)) {
// This should (almost) never occur. There is the possibility
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/linux_launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/linux_launcher.hpp b/src/slave/containerizer/linux_launcher.hpp
index 0d630fa..3730422 100644
--- a/src/slave/containerizer/linux_launcher.hpp
+++ b/src/slave/containerizer/linux_launcher.hpp
@@ -34,7 +34,7 @@ public:
virtual ~LinuxLauncher() {}
virtual process::Future<Nothing> recover(
- const std::list<state::RunState>& states);
+ const std::list<ExecutorRunState>& states);
virtual Try<pid_t> fork(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index fa40d47..e1b85b6 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -299,7 +299,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
LOG(INFO) << "Recovering containerizer";
// Gather the executor run states that we will attempt to recover.
- list<RunState> recoverable;
+ list<ExecutorRunState> recoverable;
if (state.isSome()) {
foreachvalue (const FrameworkState& framework, state.get().frameworks) {
foreachvalue (const ExecutorState& executor, framework.executors) {
@@ -321,6 +321,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
const ContainerID& containerId = executor.latest.get();
Option<RunState> run = executor.runs.get(containerId);
CHECK_SOME(run);
+ CHECK_SOME(run.get().id);
// We need the pid so the reaper can monitor the executor so skip this
// executor if it's not present. This is not an error because the slave
@@ -342,7 +343,12 @@ Future<Nothing> MesosContainerizerProcess::recover(
<< "' for executor '" << executor.id
<< "' of framework " << framework.id;
- recoverable.push_back(run.get());
+ ExecutorRunState executorRunState(
+ run.get().id.get(),
+ run.get().forkedPid.get(),
+ run.get().directory);
+
+ recoverable.push_back(executorRunState);
}
}
}
@@ -354,7 +360,7 @@ Future<Nothing> MesosContainerizerProcess::recover(
Future<Nothing> MesosContainerizerProcess::_recover(
- const list<RunState>& recoverable)
+ const list<ExecutorRunState>& recoverable)
{
// Then recover the isolators.
list<Future<Nothing>> futures;
@@ -369,16 +375,13 @@ Future<Nothing> MesosContainerizerProcess::_recover(
Future<Nothing> MesosContainerizerProcess::__recover(
- const list<RunState>& recovered)
+ const list<ExecutorRunState>& recovered)
{
- foreach (const RunState& run, recovered) {
- CHECK_SOME(run.id);
- CHECK_SOME(run.forkedPid);
-
- const ContainerID& containerId = run.id.get();
+ foreach (const ExecutorRunState& run, recovered) {
+ const ContainerID& containerId = run.id;
Container* container = new Container();
- Future<Option<int>> status = process::reap(run.forkedPid.get());
+ Future<Option<int>> status = process::reap(run.pid);
status.onAny(defer(self(), &Self::reaped, containerId));
container->status = status;
// We only checkpoint the containerizer pid after the container
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index b3aafe4..293c2d8 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -25,6 +25,8 @@
#include <stout/hashmap.hpp>
#include <stout/multihashmap.hpp>
+#include "slave/state.hpp"
+
#include "slave/containerizer/containerizer.hpp"
#include "slave/containerizer/isolator.hpp"
#include "slave/containerizer/launcher.hpp"
@@ -156,10 +158,10 @@ public:
private:
process::Future<Nothing> _recover(
- const std::list<state::RunState>& recoverable);
+ const std::list<ExecutorRunState>& recoverable);
process::Future<Nothing> __recover(
- const std::list<state::RunState>& recovered);
+ const std::list<ExecutorRunState>& recovered);
process::Future<std::list<Option<CommandInfo>>> prepare(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/79a18e60/src/tests/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/tests/isolator.hpp b/src/tests/isolator.hpp
index 7c40f3c..547b0bb 100644
--- a/src/tests/isolator.hpp
+++ b/src/tests/isolator.hpp
@@ -40,7 +40,7 @@ public:
MOCK_METHOD1(
recover,
- process::Future<Nothing>(const std::list<slave::state::RunState>&));
+ process::Future<Nothing>(const std::list<slave::ExecutorRunState>&));
virtual process::Future<Option<CommandInfo> > prepare(
const ContainerID& containerId,
[6/9] mesos git commit: Out of tree build 6: Exposed
module/isolator.hpp for out-of-tree module building.
Posted by nn...@apache.org.
Out of tree build 6: Exposed module/isolator.hpp for out-of-tree module building.
The isolation module can thus include <mesos/module/isolator.hpp> to
get all required definitions.
Review: https://reviews.apache.org/r/29604
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/45732231
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/45732231
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/45732231
Branch: refs/heads/master
Commit: 4573223193aa81bd140143546538050d938ebde4
Parents: 0082eb6
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:55:09 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:55:09 2015 -0800
----------------------------------------------------------------------
include/mesos/module/isolator.hpp | 66 ++++++++++++++++++++
src/Makefile.am | 2 +-
src/examples/test_isolator_module.cpp | 4 +-
src/module/isolator.hpp | 66 --------------------
src/slave/containerizer/mesos/containerizer.cpp | 3 +-
src/tests/isolator_tests.cpp | 4 +-
src/tests/module_tests.cpp | 2 +-
7 files changed, 74 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/include/mesos/module/isolator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/isolator.hpp b/include/mesos/module/isolator.hpp
new file mode 100644
index 0000000..452ad31
--- /dev/null
+++ b/include/mesos/module/isolator.hpp
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+
+#ifndef __MESOS_MODULE_ISOLATOR_HPP__
+#define __MESOS_MODULE_ISOLATOR_HPP__
+
+#include <mesos/mesos.hpp>
+#include <mesos/module.hpp>
+
+#include <mesos/slave/isolator.hpp>
+
+namespace mesos {
+namespace modules {
+
+template<>
+inline const char* kind<mesos::slave::Isolator>()
+{
+ return "Isolator";
+}
+
+
+template <>
+struct Module<mesos::slave::Isolator> : ModuleBase
+{
+ Module(
+ const char* _moduleApiVersion,
+ const char* _mesosVersion,
+ const char* _authorName,
+ const char* _authorEmail,
+ const char* _description,
+ bool (*_compatible)(),
+ mesos::slave::Isolator*
+ (*_create)(const Parameters& parameters))
+ : ModuleBase(
+ _moduleApiVersion,
+ _mesosVersion,
+ mesos::modules::kind<mesos::slave::Isolator>(),
+ _authorName,
+ _authorEmail,
+ _description,
+ _compatible),
+ create(_create)
+ { }
+
+ mesos::slave::Isolator* (*create)(const Parameters& parameters);
+};
+
+} // namespace modules {
+} // namespace mesos {
+
+#endif // __MESOS_MODULE_ISOLATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 00fb2a6..471af11 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -376,6 +376,7 @@ nodist_fetcher_HEADERS = ../include/mesos/fetcher/fetcher.pb.h
moduledir = $(pkgincludedir)/module
module_HEADERS = \
+ $(top_srcdir)/include/mesos/module/isolator.hpp \
$(top_srcdir)/include/mesos/module/module.hpp \
$(top_srcdir)/include/mesos/module/module.proto
@@ -494,7 +495,6 @@ libmesos_no_3rdparty_la_SOURCES += \
module/authenticatee.hpp \
module/authenticator.hpp \
module/hook.hpp \
- module/isolator.hpp \
module/manager.hpp \
sched/constants.hpp \
sched/flags.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/examples/test_isolator_module.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_isolator_module.cpp b/src/examples/test_isolator_module.cpp
index dc804fe..a66dc74 100644
--- a/src/examples/test_isolator_module.cpp
+++ b/src/examples/test_isolator_module.cpp
@@ -19,12 +19,12 @@
#include <mesos/mesos.hpp>
#include <mesos/module.hpp>
+#include <mesos/module/isolator.hpp>
+
#include <mesos/slave/isolator.hpp>
#include <stout/try.hpp>
-#include "module/isolator.hpp"
-
#include "slave/containerizer/isolators/posix.hpp"
#include "slave/flags.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/module/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/module/isolator.hpp b/src/module/isolator.hpp
deleted file mode 100644
index 4457186..0000000
--- a/src/module/isolator.hpp
+++ /dev/null
@@ -1,66 +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.
- */
-
-#ifndef __MODULE_ISOLATOR_HPP__
-#define __MODULE_ISOLATOR_HPP__
-
-#include <mesos/mesos.hpp>
-#include <mesos/module.hpp>
-
-#include <mesos/slave/isolator.hpp>
-
-namespace mesos {
-namespace modules {
-
-template<>
-inline const char* kind<mesos::slave::Isolator>()
-{
- return "Isolator";
-}
-
-
-template <>
-struct Module<mesos::slave::Isolator> : ModuleBase
-{
- Module(
- const char* _moduleApiVersion,
- const char* _mesosVersion,
- const char* _authorName,
- const char* _authorEmail,
- const char* _description,
- bool (*_compatible)(),
- mesos::slave::Isolator*
- (*_create)(const Parameters& parameters))
- : ModuleBase(
- _moduleApiVersion,
- _mesosVersion,
- mesos::modules::kind<mesos::slave::Isolator>(),
- _authorName,
- _authorEmail,
- _description,
- _compatible),
- create(_create)
- { }
-
- mesos::slave::Isolator* (*create)(const Parameters& parameters);
-};
-
-} // namespace modules {
-} // namespace mesos {
-
-#endif // __MODULE_ISOLATOR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 9910a17..d2fa50d 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+#include <mesos/module/isolator.hpp>
+
#include <mesos/slave/isolator.hpp>
#include <process/collect.hpp>
@@ -26,7 +28,6 @@
#include <stout/os.hpp>
-#include "module/isolator.hpp"
#include "module/manager.hpp"
#include "slave/paths.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/tests/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/isolator_tests.cpp b/src/tests/isolator_tests.cpp
index 7123a40..ab4bacc 100644
--- a/src/tests/isolator_tests.cpp
+++ b/src/tests/isolator_tests.cpp
@@ -26,6 +26,8 @@
#include <mesos/resources.hpp>
+#include <mesos/module/isolator.hpp>
+
#include <mesos/slave/isolator.hpp>
#include <process/future.hpp>
@@ -44,8 +46,6 @@
#include "master/master.hpp"
#include "master/detector.hpp"
-#include "module/isolator.hpp"
-
#include "slave/flags.hpp"
#include "slave/slave.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/45732231/src/tests/module_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module_tests.cpp b/src/tests/module_tests.cpp
index 5131309..64e05c1 100644
--- a/src/tests/module_tests.cpp
+++ b/src/tests/module_tests.cpp
@@ -18,6 +18,7 @@
#include <mesos/module.hpp>
+#include <mesos/module/isolator.hpp>
#include <mesos/module/module.hpp>
#include <mesos/slave/isolator.hpp>
@@ -27,7 +28,6 @@
#include "common/parse.hpp"
#include "examples/test_module.hpp"
-#include "module/isolator.hpp"
#include "module/manager.hpp"
#include "tests/flags.hpp"
[2/9] mesos git commit: Out of tree build 2: Moved operators for
internal protobufs to messages/messages.hpp.
Posted by nn...@apache.org.
Out of tree build 2: Moved operators for internal protobufs to messages/messages.hpp.
This allows type_utils.hpp to have operators corresponding to public
protobufs defined in mesos.proto only. This change prepares us to move
type_utils.hpp to include/mesos/ as a public header.
Review: https://reviews.apache.org/r/29780
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1d68340f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1d68340f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1d68340f
Branch: refs/heads/master
Commit: 1d68340f58cf48c4ccd9f557aeee2861b3d35536
Parents: 1643735
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 10 09:51:59 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Tue Feb 10 09:52:53 2015 -0800
----------------------------------------------------------------------
src/common/type_utils.cpp | 2 ++
src/common/type_utils.hpp | 41 ------------------------------------
src/messages/messages.hpp | 43 ++++++++++++++++++++++++++++++++++++++
src/slave/state.cpp | 2 ++
src/tests/registrar_tests.cpp | 1 +
5 files changed, 48 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1d68340f/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index 6062e43..206cdfc 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -22,6 +22,8 @@
#include "common/attributes.hpp"
#include "common/type_utils.hpp"
+#include "messages/messages.hpp"
+
namespace mesos {
bool operator == (const CommandInfo& left, const CommandInfo& right)
http://git-wip-us.apache.org/repos/asf/mesos/blob/1d68340f/src/common/type_utils.hpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.hpp b/src/common/type_utils.hpp
index 6c68943..9abfb1c 100644
--- a/src/common/type_utils.hpp
+++ b/src/common/type_utils.hpp
@@ -27,11 +27,6 @@
#include <stout/uuid.hpp>
-#include "common/attributes.hpp"
-
-#include "messages/log.hpp"
-#include "messages/messages.hpp"
-
// This file includes definitions for operators on protobuf classes
// that don't have these operators generated by the protobuf compiler.
@@ -356,9 +351,6 @@ inline std::ostream& operator << (
}
-bool operator == (const Task& left, const Task& right);
-
-
inline std::ostream& operator << (
std::ostream& stream,
const Modules& modules)
@@ -366,39 +358,6 @@ inline std::ostream& operator << (
return stream << modules.DebugString();
}
-
-std::ostream& operator << (
- std::ostream& stream,
- const StatusUpdate& update);
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const StatusUpdateRecord::Type& type)
-{
- return stream
- << StatusUpdateRecord::Type_descriptor()->FindValueByNumber(type)->name();
-}
-
-
-namespace log {
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const Action::Type& type)
-{
- return stream << Action::Type_Name(type);
-}
-
-
-inline std::ostream& operator << (
- std::ostream& stream,
- const Metadata::Status& status)
-{
- return stream << Metadata::Status_Name(status);
-}
-
-} // namespace log {
} // namespace mesos {
#endif // __TYPE_UTILS_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/1d68340f/src/messages/messages.hpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.hpp b/src/messages/messages.hpp
index 77840bc..25769b7 100644
--- a/src/messages/messages.hpp
+++ b/src/messages/messages.hpp
@@ -28,6 +28,7 @@
#include <stout/error.hpp>
#include <stout/try.hpp>
+#include "messages/log.hpp"
#include "messages/messages.pb.h"
namespace messages {
@@ -60,4 +61,46 @@ Try<std::string> serialize(const T& t)
} // namespace messages {
+
+// Definitions for operators on protobuf classes that don't have these
+// operators generated by the protobuf compiler.
+
+namespace mesos {
+
+bool operator == (const Task& left, const Task& right);
+
+
+std::ostream& operator << (
+ std::ostream& stream,
+ const StatusUpdate& update);
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const StatusUpdateRecord::Type& type)
+{
+ return stream
+ << StatusUpdateRecord::Type_descriptor()->FindValueByNumber(type)->name();
+}
+
+
+namespace log {
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const Action::Type& type)
+{
+ return stream << Action::Type_Name(type);
+}
+
+
+inline std::ostream& operator << (
+ std::ostream& stream,
+ const Metadata::Status& status)
+{
+ return stream << Metadata::Status_Name(status);
+}
+
+} // namespace log {
+} // namespace mesos {
+
#endif // __MESSAGES_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/1d68340f/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index d0d7eba..24ab12c 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -15,6 +15,8 @@
#include <stout/protobuf.hpp>
#include <stout/try.hpp>
+#include "messages/messages.hpp"
+
#include "slave/paths.hpp"
#include "slave/state.hpp"
http://git-wip-us.apache.org/repos/asf/mesos/blob/1d68340f/src/tests/registrar_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/registrar_tests.cpp b/src/tests/registrar_tests.cpp
index 3d71233..510595d 100644
--- a/src/tests/registrar_tests.cpp
+++ b/src/tests/registrar_tests.cpp
@@ -31,6 +31,7 @@
#include <stout/stopwatch.hpp>
#include <stout/uuid.hpp>
+#include "common/attributes.hpp"
#include "common/protobuf_utils.hpp"
#include "common/type_utils.hpp"