Apache Mesos
mem.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_MEM_ISOLATOR_HPP__
18 #define __WINDOWS_MEM_ISOLATOR_HPP__
19 
20 #include <vector>
21 
22 #include <process/future.hpp>
23 #include <process/id.hpp>
24 
25 #include <stout/bytes.hpp>
26 #include <stout/hashmap.hpp>
27 #include <stout/hashset.hpp>
28 #include <stout/nothing.hpp>
29 #include <stout/try.hpp>
30 #include <stout/windows.hpp>
31 
32 #include "slave/flags.hpp"
33 
35 
36 namespace mesos {
37 namespace internal {
38 namespace slave {
39 
41 {
42 public:
44 
45  bool supportsNesting() override;
46  bool supportsStandalone() override;
47 
49  const std::vector<mesos::slave::ContainerState>& state,
50  const hashset<ContainerID>& orphans) override;
51 
53  const ContainerID& containerId,
54  const mesos::slave::ContainerConfig& containerConfig) override;
55 
57  const ContainerID& containerId, pid_t pid) override;
58 
60  const ContainerID& containerId,
61  const Resources& resourceRequests,
62  const google::protobuf::Map<
63  std::string, Value::Scalar>& resourceLimits = {}) override;
64 
66  const ContainerID& containerId) override;
67 
68  process::Future<Nothing> cleanup(const ContainerID& containerId) override;
69 
70 private:
71  struct Info
72  {
73  Option<pid_t> pid;
74  Option<Bytes> limit;
75  };
76 
78 
80  : ProcessBase(process::ID::generate("windows-mem-isolator"))
81  {}
82 };
83 
84 } // namespace slave {
85 } // namespace internal {
86 } // namespace mesos {
87 
88 #endif // __WINDOWS_MEM_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
process::Future< Nothing > isolate(const ContainerID &containerId, pid_t pid) override
process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig) override
Definition: resources.hpp:83
static Try< mesos::slave::Isolator * > create(const Flags &flags)
Definition: flags.hpp:39
process::Future< ResourceStatistics > usage(const ContainerID &containerId) override
process::Future< Nothing > cleanup(const ContainerID &containerId) override
DWORD pid_t
Definition: windows.hpp:181
process::Future< Nothing > recover(const std::vector< mesos::slave::ContainerState > &state, const hashset< ContainerID > &orphans) 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
Definition: attributes.hpp:24
Definition: parse.hpp:33