Apache Mesos
disk_profile_adaptor.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 __MESOS_RESOURCE_PROVIDER_DISK_PROFILE_ADAPTOR_HPP__
18 #define __MESOS_RESOURCE_PROVIDER_DISK_PROFILE_ADAPTOR_HPP__
19 
20 #include <memory>
21 #include <string>
22 #include <tuple>
23 
24 #include <mesos/mesos.hpp>
25 
26 #include <mesos/csi/types.hpp>
27 
28 #include <process/future.hpp>
29 
30 #include <stout/hashset.hpp>
31 #include <stout/none.hpp>
32 #include <stout/nothing.hpp>
33 
34 namespace mesos {
35 
53 {
54 public:
55  struct ProfileInfo
56  {
66  csi::types::VolumeCapability capability;
67 
73  google::protobuf::Map<std::string, std::string> parameters;
74  };
75 
86  const Option<std::string>& name = None());
87 
96  static void setAdaptor(const std::shared_ptr<DiskProfileAdaptor>& adaptor);
97  static std::shared_ptr<DiskProfileAdaptor> getAdaptor();
98 
99  virtual ~DiskProfileAdaptor() {}
100 
120  const std::string& profile,
121  const ResourceProviderInfo& resourceProviderInfo) = 0;
122 
140  const hashset<std::string>& knownProfiles,
141  const ResourceProviderInfo& resourceProviderInfo) = 0;
142 
143 protected:
145 };
146 
147 } // namespace mesos {
148 
149 #endif // __MESOS_RESOURCE_PROVIDER_DISK_PROFILE_ADAPTOR_HPP__
virtual process::Future< ProfileInfo > translate(const std::string &profile, const ResourceProviderInfo &resourceProviderInfo)=0
Returns the CSI volume capability and the parameters to create CSI volumes associated with the profil...
google::protobuf::Map< std::string, std::string > parameters
Free-form key-value pairs which should be passed into the body of a CreateVolumeRequest.
Definition: disk_profile_adaptor.hpp:73
Definition: check.hpp:33
virtual ~DiskProfileAdaptor()
Definition: disk_profile_adaptor.hpp:99
static void setAdaptor(const std::shared_ptr< DiskProfileAdaptor > &adaptor)
Global methods for setting and getting a DiskProfileAdaptor instance.
csi::types::VolumeCapability capability
Corresponds to the volume_capability or volume_capabilities fields of the affected CSI requests liste...
Definition: disk_profile_adaptor.hpp:66
Definition: adaptor.hpp:21
Definition: agent.hpp:25
Definition: disk_profile_adaptor.hpp:55
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::Dis...
Definition: disk_profile_adaptor.hpp:52
static std::shared_ptr< DiskProfileAdaptor > getAdaptor()
Definition: none.hpp:27
virtual process::Future< hashset< std::string > > watch(const hashset< std::string > &knownProfiles, const ResourceProviderInfo &resourceProviderInfo)=0
Returns a future that will be satisifed iff the set of profiles known by the module differs from the ...
static Try< DiskProfileAdaptor * > create(const Option< std::string > &name=None())
Factory method used to create a DiskProfileAdaptor instance.
DiskProfileAdaptor()
Definition: disk_profile_adaptor.hpp:144
constexpr const char * name
Definition: shell.hpp:43
Definition: future.hpp:58