Apache Mesos
cpu.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 __WINDOWS_CPU_ISOLATOR_HPP__
18 #define __WINDOWS_CPU_ISOLATOR_HPP__
19 
20 #include <vector>
21 
22 #include <process/future.hpp>
23 #include <process/id.hpp>
24 
25 #include <stout/hashmap.hpp>
26 #include <stout/hashset.hpp>
27 #include <stout/nothing.hpp>
28 #include <stout/try.hpp>
29 #include <stout/windows.hpp>
30 
31 #include "slave/flags.hpp"
32 
34 
35 namespace mesos {
36 namespace internal {
37 namespace slave {
38 
40 {
41 public:
43 
44  bool supportsNesting() override;
45  bool supportsStandalone() override;
46 
48  const std::vector<mesos::slave::ContainerState>& state,
49  const hashset<ContainerID>& orphans) override;
50 
52  const ContainerID& containerId,
53  const mesos::slave::ContainerConfig& containerConfig) override;
54 
56  const ContainerID& containerId, pid_t pid) override;
57 
59  const ContainerID& containerId, const Resources& resources) override;
60 
62  const ContainerID& containerId) override;
63 
64  process::Future<Nothing> cleanup(const ContainerID& containerId) override;
65 
66 private:
67  struct Info
68  {
69  Option<pid_t> pid;
70  Option<double> limit;
71  };
72 
74 
76  : ProcessBase(process::ID::generate("windows-cpu-isolator"))
77  {}
78 };
79 
80 } // namespace slave {
81 } // namespace internal {
82 } // namespace mesos {
83 
84 #endif // __WINDOWS_CPU_ISOLATOR_HPP__
std::string generate(const std::string &prefix="")
Returns &#39;prefix(N)&#39; where N represents the number of instances where the same prefix (wrt...
ProcessBase(const std::string &id="")
Definition: check.hpp:33
Definition: resources.hpp:81
process::Future< Nothing > recover(const std::vector< mesos::slave::ContainerState > &state, const hashset< ContainerID > &orphans) override
Definition: flags.hpp:39
DWORD pid_t
Definition: windows.hpp:181
process::Future< Nothing > update(const ContainerID &containerId, const Resources &resources) override
process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig) override
process::Future< Nothing > cleanup(const ContainerID &containerId) override
Definition: spec.hpp:26
process::Future< Nothing > isolate(const ContainerID &containerId, pid_t pid) override
Definition: attributes.hpp:24
static Try< mesos::slave::Isolator * > create(const Flags &flags)
process::Future< ResourceStatistics > usage(const ContainerID &containerId) override
Definition: parse.hpp:33