Apache Mesos
isolator.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 __ISOLATOR_HPP__
18 #define __ISOLATOR_HPP__
19 
20 #include <mesos/slave/isolator.hpp>
21 
22 #include <process/owned.hpp>
23 #include <process/process.hpp>
24 
25 #include <stout/none.hpp>
26 
27 namespace mesos {
28 namespace internal {
29 namespace slave {
30 
31 // Forward declaration.
32 class MesosIsolatorProcess;
33 
34 
35 // A wrapper class that implements the 'Isolator' interface which is
36 // backed by an 'MesosIsolatorProcess'. This helper class is useful
37 // for programmers to write asynchronous isolators.
39 {
40 public:
42  virtual ~MesosIsolator();
43 
44  virtual bool supportsNesting();
45  virtual bool supportsStandalone();
46 
48  const std::vector<mesos::slave::ContainerState>& states,
49  const hashset<ContainerID>& orphans);
50 
52  const ContainerID& containerId,
53  const mesos::slave::ContainerConfig& containerConfig);
54 
56  const ContainerID& containerId,
57  pid_t pid);
58 
60  const ContainerID& containerId);
61 
63  const ContainerID& containerId,
64  const Resources& resources);
65 
67  const ContainerID& containerId);
68 
70  const ContainerID& containerId);
71 
73  const ContainerID& containerId);
74 
75 private:
77 };
78 
79 
80 class MesosIsolatorProcess : public process::Process<MesosIsolatorProcess>
81 {
82 public:
83  virtual ~MesosIsolatorProcess() {}
84 
85  virtual bool supportsNesting()
86  {
87  return false;
88  }
89 
90  virtual bool supportsStandalone()
91  {
92  return false;
93  }
94 
96  const std::vector<mesos::slave::ContainerState>& states,
97  const hashset<ContainerID>& orphans)
98  {
99  return Nothing();
100  }
101 
103  const ContainerID& containerId,
104  const mesos::slave::ContainerConfig& containerConfig)
105  {
106  return None();
107  }
108 
110  const ContainerID& containerId,
111  pid_t pid)
112  {
113  return Nothing();
114  }
115 
117  const ContainerID& containerId)
118  {
120  }
121 
123  const ContainerID& containerId,
124  const Resources& resources)
125  {
126  return Nothing();
127  }
128 
130  const ContainerID& containerId)
131  {
132  return ResourceStatistics();
133  }
134 
136  const ContainerID& containerId)
137  {
138  return ContainerStatus();
139  };
140 
142  const ContainerID& containerId)
143  {
144  return Nothing();
145  }
146 };
147 
148 } // namespace slave {
149 } // namespace internal {
150 } // namespace mesos {
151 
152 #endif // __ISOLATOR_HPP__
virtual process::Future< ResourceStatistics > usage(const ContainerID &containerId)
Definition: isolator.hpp:129
Definition: isolator.hpp:38
Definition: nothing.hpp:16
virtual process::Future< Nothing > cleanup(const ContainerID &containerId)
virtual process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig)
Definition: isolator.hpp:102
virtual ~MesosIsolatorProcess()
Definition: isolator.hpp:83
virtual process::Future< mesos::slave::ContainerLimitation > watch(const ContainerID &containerId)
Definition: resources.hpp:79
virtual process::Future< ContainerStatus > status(const ContainerID &containerId)
Definition: isolator.hpp:135
virtual process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig)
MesosIsolator(process::Owned< MesosIsolatorProcess > process)
DWORD pid_t
Definition: windows.hpp:181
virtual bool supportsNesting()
Definition: isolator.hpp:85
virtual process::Future< Nothing > cleanup(const ContainerID &containerId)
Definition: isolator.hpp:141
Definition: spec.hpp:30
virtual process::Future< Nothing > update(const ContainerID &containerId, const Resources &resources)
Definition: isolator.hpp:122
virtual process::Future< Nothing > isolate(const ContainerID &containerId, pid_t pid)
virtual bool supportsStandalone()
Definition: isolator.hpp:90
virtual process::Future< mesos::slave::ContainerLimitation > watch(const ContainerID &containerId)
Definition: isolator.hpp:116
Definition: none.hpp:27
Definition: attributes.hpp:24
Definition: executor.hpp:48
virtual process::Future< Nothing > isolate(const ContainerID &containerId, pid_t pid)
Definition: isolator.hpp:109
virtual process::Future< ResourceStatistics > usage(const ContainerID &containerId)
virtual process::Future< Nothing > recover(const std::vector< mesos::slave::ContainerState > &states, const hashset< ContainerID > &orphans)
Definition: owned.hpp:36
virtual process::Future< ContainerStatus > status(const ContainerID &containerId)
Definition: process.hpp:501
Definition: isolator.hpp:39
virtual process::Future< Nothing > recover(const std::vector< mesos::slave::ContainerState > &states, const hashset< ContainerID > &orphans)
Definition: isolator.hpp:95
virtual process::Future< Nothing > update(const ContainerID &containerId, const Resources &resources)