17 #ifndef __RESOURCE_PROVIDER_URI_DISK_PROFILE_ADAPTOR_HPP__ 18 #define __RESOURCE_PROVIDER_URI_DISK_PROFILE_ADAPTOR_HPP__ 47 class UriDiskProfileAdaptorProcess;
72 "URI to a JSON object containing the disk profile mapping.\n" 73 "This module supports both HTTP(s) and file URIs\n." 75 "The JSON object should consist of some top-level string keys\n" 76 "corresponding to the disk profile name. Each value should contain\n" 77 "a `ResourceProviderSelector` under 'resource_provider_selector' or\n" 78 "a `CSIPluginTypeSelector` under 'csi_plugin_type_selector' to\n" 79 "specify the set of resource providers this profile applies to,\n" 80 "followed by a `VolumeCapability` under 'volume_capabilities'\n" 81 "and a free-form string-string mapping under 'create_parameters'.\n" 83 "The JSON is modeled after a protobuf found in\n" 84 "`src/resource_provider/storage/disk_profile.proto`.\n" 88 " \"profile_matrix\" : {\n" 89 " \"my-profile\" : {\n" 90 " \"csi_plugin_type_selector\": {\n" 91 " \"plugin_type\" : \"org.apache.mesos.csi.test\"\n" 93 " \"volume_capabilities\" : {\n" 95 " \"access_mode\" : { \"mode\" : \"SINGLE_NODE_WRITER\" }\n" 97 " \"create_parameters\" : {\n" 98 " \"mesos-does-not\" : \"interpret-these\",\n" 99 " \"type\" : \"raid5\",\n" 100 " \"stripes\" : \"3\",\n" 101 " \"stripesize\" : \"64\"\n" 106 static_cast<const Path*>(
nullptr),
113 #ifdef USE_SSL_SOCKET
116 #endif // USE_SSL_SOCKET 122 return Error(
"Failed to parse URI: " + url.
error());
131 "--uri must use a supported scheme (file or http(s))");
136 return Error(
"--uri to a file must be an absolute path");
144 "How long to wait between polling the specified `--uri`.\n" 145 "The time is checked each time the `translate` method is called.\n" 146 "If the given time has elapsed, then the URI is re-fetched.\n" 147 "If not specified, the URI is only fetched once.",
150 return Error(
"--poll_interval must be non-negative");
158 "How long at most to wait between discovering a new set of profiles\n" 159 "and notifying the callers of `watch`. The actual wait time is a\n" 160 "uniform random value between 0 and this value. If `--uri` points\n" 161 "to a centralized location, it may be good to scale this number\n" 162 "according to the number of resource providers in the cluster.",
166 return Error(
"--max_random_wait must be zero or greater");
189 const std::string& profile,
190 const ResourceProviderInfo& resourceProviderInfo)
override;
194 const ResourceProviderInfo& resourceProviderInfo)
override;
211 const std::string& profile,
212 const ResourceProviderInfo& resourceProviderInfo);
216 const ResourceProviderInfo& resourceProviderInfo);
231 void notify(
const resource_provider::DiskProfileMapping& parsed);
237 resource_provider::DiskProfileMapping::CSIManifest
manifest;
254 : known(_known), info(_info) {}
257 ResourceProviderInfo info;
261 std::vector<WatcherData> watchers;
268 #endif // __RESOURCE_PROVIDER_URI_DISK_PROFILE_ADAPTOR_HPP__ Definition: uri_disk_profile_adaptor.hpp:202
Definition: errorbase.hpp:36
Option< Duration > poll_interval
Definition: uri_disk_profile_adaptor.hpp:179
static Try< URL > parse(const std::string &urlString)
Definition: uri_disk_profile_adaptor.hpp:65
Future< short > poll(int_fd fd, short events)
Returns the events (a subset of the events specified) that can be performed on the specified file des...
URI manifest(const std::string &repository, const std::string &reference, const std::string ®istry, const Option< std::string > &scheme=None(), const Option< int > &port=None())
Definition: docker.hpp:47
Definition: duration.hpp:32
bool isSome() const
Definition: option.hpp:116
bool contains(const std::string &s, const std::string &substr)
Definition: strings.hpp:423
Try< Nothing > initialize(const Flags &flags)
Initialized state for support of systemd functions in this file.
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:212
Definition: duration.hpp:207
Definition: future.hpp:74
const T & get() const &
Definition: option.hpp:119
Protocol< PromiseRequest, PromiseResponse > promise
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::Dis...
Definition: disk_profile_adaptor.hpp:50
static Try error(const E &e)
Definition: try.hpp:43
~UriDiskProfileAdaptor() override
#define flags
Definition: decoder.hpp:18
Flags()
Definition: uri_disk_profile_adaptor.hpp:67
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
Path uri
Definition: uri_disk_profile_adaptor.hpp:177
process::Future< DiskProfileAdaptor::ProfileInfo > translate(const std::string &profile, const ResourceProviderInfo &resourceProviderInfo) override
Returns the CSI volume capability and the parameters to create CSI volumes associated with the profil...
Definition: uri_disk_profile_adaptor.hpp:62
void add(T1 Flags::*t1, const Name &name, const Option< Name > &alias, const std::string &help, const T2 *t2, F validate)
Definition: flags.hpp:333
process::Future< hashset< std::string > > watch(const hashset< std::string > &knownProfiles, const ResourceProviderInfo &resourceProviderInfo) override
Returns a future that will be satisifed iff the set of profiles known by the module differs from the ...
UriDiskProfileAdaptor(const Flags &_flags)
process::Owned< UriDiskProfileAdaptorProcess > process
Definition: uri_disk_profile_adaptor.hpp:198
Flags flags
Definition: uri_disk_profile_adaptor.hpp:197
Duration max_random_wait
Definition: uri_disk_profile_adaptor.hpp:180
bool startsWith(const std::string &s, const std::string &prefix)
Definition: strings.hpp:381
Definition: process.hpp:505
const std::string & string() const
Definition: path.hpp:387
bool is_absolute() const
Definition: path.hpp:376
Definition: future.hpp:58