Apache Mesos
disk.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 __XFS_DISK_ISOLATOR_HPP__
18 #define __XFS_DISK_ISOLATOR_HPP__
19 
20 #include <string>
21 
22 #include <process/owned.hpp>
23 
24 #include <stout/bytes.hpp>
25 #include <stout/duration.hpp>
26 #include <stout/hashmap.hpp>
27 
28 #include "slave/flags.hpp"
29 
31 
33 
34 namespace mesos {
35 namespace internal {
36 namespace slave {
37 
39 {
40 public:
42 
43  virtual ~XfsDiskIsolatorProcess();
44 
46  {
48  }
49 
51  const std::list<mesos::slave::ContainerState>& states,
52  const hashset<ContainerID>& orphans);
53 
55  const ContainerID& containerId,
56  const mesos::slave::ContainerConfig& containerConfig);
57 
59  const ContainerID& containerId,
60  pid_t pid);
61 
63  const ContainerID& containerId,
64  const Resources& resources);
65 
67  const ContainerID& containerId);
68 
70  const ContainerID& containerId);
71 
72 private:
74  xfs::QuotaPolicy quotaPolicy,
75  const std::string& workDir,
76  const IntervalSet<prid_t>& projectIds);
77 
78  // Take the next project ID from the unallocated pool.
79  Option<prid_t> nextProjectId();
80 
81  // Return this project ID to the unallocated pool.
82  void returnProjectId(prid_t projectId);
83 
84  struct Info
85  {
86  explicit Info(const std::string& _directory, prid_t _projectId)
87  : directory(_directory), quota(0), projectId(_projectId) {}
88 
89  const std::string directory;
90  Bytes quota;
91  const prid_t projectId;
92  };
93 
94  xfs::QuotaPolicy quotaPolicy;
95  const std::string workDir;
96  const IntervalSet<prid_t> totalProjectIds;
97  IntervalSet<prid_t> freeProjectIds;
99 };
100 
101 } // namespace slave {
102 } // namespace internal {
103 } // namespace mesos {
104 
105 #endif // __XFS_DISK_ISOLATOR_HPP__
Definition: option.hpp:28
Definition: try.hpp:34
virtual process::Future< Nothing > recover(const std::list< mesos::slave::ContainerState > &states, const hashset< ContainerID > &orphans)
Definition: resources.hpp:79
Definition: flags.hpp:39
virtual process::Future< ResourceStatistics > usage(const ContainerID &containerId)
Definition: hashmap.hpp:38
DWORD pid_t
Definition: windows.hpp:187
virtual process::Future< Nothing > cleanup(const ContainerID &containerId)
static Try< mesos::slave::Isolator * > create(const Flags &flags)
QuotaPolicy
Definition: utils.hpp:72
virtual process::Future< Nothing > isolate(const ContainerID &containerId, pid_t pid)
#define flags
Definition: decoder.hpp:18
A &quot;process identifier&quot; used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:279
virtual process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig)
Definition: bytes.hpp:30
virtual process::Future< Nothing > update(const ContainerID &containerId, const Resources &resources)