Apache Mesos
linux_launcher.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __LINUX_LAUNCHER_HPP__
18 #define __LINUX_LAUNCHER_HPP__
19 
20 #include <process/owned.hpp>
21 
23 
24 namespace mesos {
25 namespace internal {
26 namespace slave {
27 
28 class LinuxLauncherProcess;
29 
30 // Launcher for Linux systems with cgroups. Uses a freezer cgroup to
31 // track pids.
32 class LinuxLauncher : public Launcher
33 {
34 public:
35  static Try<Launcher*> create(const Flags& flags);
36 
37  // Returns 'true' if prerequisites for using LinuxLauncher are available.
38  static bool available();
39 
40  ~LinuxLauncher() override;
41 
43  const std::vector<mesos::slave::ContainerState>& states) override;
44 
46  const ContainerID& containerId,
47  const std::string& path,
48  const std::vector<std::string>& argv,
49  const mesos::slave::ContainerIO& containerIO,
50  const flags::FlagsBase* flags,
51  const Option<std::map<std::string, std::string>>& environment,
52  const Option<int>& enterNamespaces,
53  const Option<int>& cloneNamespaces,
54  const std::vector<int_fd>& whitelistFds) override;
55 
56  process::Future<Nothing> destroy(const ContainerID& containerId) override;
57 
59  const ContainerID& containerId) override;
60 
61 private:
63  const Flags& flags,
64  const std::string& freezerHierarchy,
65  const Option<std::string>& systemdHierarchy);
66 
68 };
69 
70 } // namespace slave {
71 } // namespace internal {
72 } // namespace mesos {
73 
74 #endif // __LINUX_LAUNCHER_HPP__
Definition: path.hpp:29
Definition: launcher.hpp:47
Definition: option.hpp:29
Definition: check.hpp:33
process::Future< hashset< ContainerID > > recover(const std::vector< mesos::slave::ContainerState > &states) override
An abstraction around the IO classes used to redirect stdin/stdout/stderr to/from a container by the ...
Definition: containerizer.hpp:37
Definition: flags.hpp:39
Environment * environment
process::Future< ContainerStatus > status(const ContainerID &containerId) override
Definition: linux_launcher.hpp:32
Definition: flags.hpp:44
Definition: agent.hpp:25
Try< pid_t > fork(const ContainerID &containerId, const std::string &path, const std::vector< std::string > &argv, const mesos::slave::ContainerIO &containerIO, const flags::FlagsBase *flags, const Option< std::map< std::string, std::string >> &environment, const Option< int > &enterNamespaces, const Option< int > &cloneNamespaces, const std::vector< int_fd > &whitelistFds) override
static Try< Launcher * > create(const Flags &flags)
Definition: attributes.hpp:24
Definition: executor.hpp:48
process::Future< Nothing > destroy(const ContainerID &containerId) override
Definition: parse.hpp:33
Definition: future.hpp:58