17 #ifndef __RESOURCE_PROVIDER_URI_DISK_PROFILE_HPP__
18 #define __RESOURCE_PROVIDER_URI_DISK_PROFILE_HPP__
48 class UriDiskProfileAdaptorProcess;
57 "URI to a JSON object containing the disk profile mapping.\n"
58 "This module supports both HTTP(s) and file URIs\n."
60 "The JSON object should consist of some top-level string keys\n"
61 "corresponding to the disk profile name. Each value should\n"
62 "contain a `VolumeCapability` under a 'volume_capabilities'\n"
63 "and a free-form string-string mapping under 'create_parameters'.\n"
65 "The JSON is modeled after a protobuf found in\n"
66 "`src/csi/uri_disk_profile.proto`.\n"
70 " \"profile_matrix\" : {\n"
71 " \"my-profile\" : {\n"
72 " \"volume_capabilities\" : {\n"
74 " \"access_mode\" : { \"mode\" : \"SINGLE_NODE_WRITER\" }\n"
76 " \"create_parameters\" : {\n"
77 " \"mesos-does-not\" : \"interpret-these\",\n"
78 " \"type\" : \"raid5\",\n"
79 " \"stripes\" : \"3\",\n"
80 " \"stripesize\" : \"64\"\n"
85 static_cast<const Path*>(
nullptr),
95 #endif // USE_SSL_SOCKET
101 return Error(
"Failed to parse URI: " + url.
error());
109 return Error(
"--uri must use a supported scheme (file or http(s))");
114 return Error(
"--uri to a file must be an absolute path");
122 "How long to wait between polling the specified `--uri`.\n"
123 "The time is checked each time the `translate` method is called.\n"
124 "If the given time has elapsed, then the URI is re-fetched."
125 "If not specified, the URI is only fetched once.",
128 return Error(
"--poll_interval must be non-negative");
136 "How long at most to wait between discovering a new set of profiles\n"
137 "and notifying the callers of `watch`. The actual wait time is a\n"
138 "uniform random value between 0 and this value. If the `--uri` points\n"
139 "to a centralized location, it may be good to scale this number\n"
140 "according to the number of resource providers in the cluster.",
144 return Error(
"--max_random_wait must be zero or greater");
182 const std::string& profile,
183 const std::string& csiPluginInfoType)
override;
187 const std::string& csiPluginInfoType)
override;
204 const std::string& profile,
205 const std::string& csiPluginInfoType);
209 const std::string& csiPluginInfoType);
223 void notify(
const resource_provider::DiskProfileMapping& parsed);
233 std::map<std::string, DiskProfileAdaptor::ProfileInfo> data;
248 #endif // __RESOURCE_PROVIDER_URI_DISK_PROFILE_HPP__
Definition: uri_disk_profile.hpp:174
Definition: errorbase.hpp:35
static Try< URL > parse(const std::string &urlString)
virtual void initialize() override
Invoked when a process gets spawned.
Flags flags
Definition: uri_disk_profile.hpp:190
Definition: uri_disk_profile.hpp:50
virtual ~UriDiskProfileAdaptor()
virtual process::Future< hashset< std::string > > watch(const hashset< std::string > &knownProfiles, const std::string &csiPluginInfoType) override
Returns a future that will be satisifed iff the set of profiles known by the module differs from the ...
Definition: duration.hpp:32
bool isSome() const
Definition: option.hpp:115
Path uri
Definition: uri_disk_profile.hpp:155
bool contains(const std::string &s, const std::string &substr)
Definition: strings.hpp:406
Option< Duration > poll_interval
Definition: uri_disk_profile.hpp:157
UriDiskProfileAdaptor(const Flags &_flags)
Duration max_random_wait
Definition: uri_disk_profile.hpp:158
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:145
Definition: duration.hpp:259
const T & get() const &
Definition: option.hpp:118
This module is used by Storage Resource Providers to translate the "profile" field of a Resource::Dis...
Definition: disk_profile.hpp:50
process::Owned< UriDiskProfileAdaptorProcess > process
Definition: uri_disk_profile.hpp:191
bool absolute() const
Definition: path.hpp:306
process::Future< hashset< std::string > > watch(const hashset< std::string > &knownProfiles, const std::string &csiPluginInfoType)
static Try error(const E &e)
Definition: try.hpp:42
process::Future< mesos::DiskProfileAdaptor::ProfileInfo > translate(const std::string &profile, const std::string &csiPluginInfoType)
Definition: uri_disk_profile.hpp:195
#define flags
Definition: decoder.hpp:18
bool isError() const
Definition: try.hpp:71
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
UriDiskProfileAdaptorProcess(const Flags &_flags)
virtual process::Future< mesos::DiskProfileAdaptor::ProfileInfo > translate(const std::string &profile, const std::string &csiPluginInfoType) override
Called before a Storage Resource Provider makes an affected CSI request.
bool startsWith(const std::string &s, const std::string &prefix)
Definition: strings.hpp:380
Definition: process.hpp:493
const std::string & string() const
Definition: path.hpp:317
Flags()
Definition: uri_disk_profile.hpp:52
Definition: future.hpp:57