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 <process/future.hpp>
27 
28 #include <stout/hashset.hpp>
29 #include <stout/none.hpp>
30 #include <stout/nothing.hpp>
31 
32 namespace mesos {
33 
51 {
52 public:
53  struct ProfileInfo
54  {
64  Volume::Source::CSIVolume::VolumeCapability capability;
65 
71  google::protobuf::Map<std::string, std::string> parameters;
72  };
73 
84  const Option<std::string>& name = None());
85 
94  static void setAdaptor(const std::shared_ptr<DiskProfileAdaptor>& adaptor);
95  static std::shared_ptr<DiskProfileAdaptor> getAdaptor();
96 
97  virtual ~DiskProfileAdaptor() {}
98 
118  const std::string& profile,
119  const ResourceProviderInfo& resourceProviderInfo) = 0;
120 
138  const hashset<std::string>& knownProfiles,
139  const ResourceProviderInfo& resourceProviderInfo) = 0;
140 
141 protected:
143 };
144 
145 } // namespace mesos {
146 
147 #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:71
Definition: check.hpp:33
virtual ~DiskProfileAdaptor()
Definition: disk_profile_adaptor.hpp:97
Volume::Source::CSIVolume::VolumeCapability capability
Corresponds to the volume_capability or volume_capabilities fields of the affected CSI requests liste...
Definition: disk_profile_adaptor.hpp:64
static void setAdaptor(const std::shared_ptr< DiskProfileAdaptor > &adaptor)
Global methods for setting and getting a DiskProfileAdaptor instance.
Definition: adaptor.hpp:21
Definition: agent.hpp:25
Definition: disk_profile_adaptor.hpp:53
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::Dis...
Definition: disk_profile_adaptor.hpp:50
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:142
constexpr const char * name
Definition: shell.hpp:41
Definition: future.hpp:58