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,
60  const Resources& resourceRequests,
61  const google::protobuf::Map<
62  std::string, Value::Scalar>& resourceLimits = {}) override;
63 
65  const ContainerID& containerId) override;
66 
67  process::Future<Nothing> cleanup(const ContainerID& containerId) override;
68 
69 private:
70  struct Info
71  {
72  Option<pid_t> pid;
73  Option<double> limit;
74  };
75 
77 
79  : ProcessBase(process::ID::generate("windows-cpu-isolator"))
80  {}
81 };
82 
83 } // namespace slave {
84 } // namespace internal {
85 } // namespace mesos {
86 
87 #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:83
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< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig) override
process::Future< Nothing > cleanup(const ContainerID &containerId) override
Definition: agent.hpp:25
process::Future< Nothing > update(const ContainerID &containerId, const Resources &resourceRequests, const google::protobuf::Map< std::string, Value::Scalar > &resourceLimits={}) override
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