Apache Mesos
disk_profile_utils.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 __RESOURCE_PROVIDER_URI_DISK_PROFILE_UTILS_HPP__
18 #define __RESOURCE_PROVIDER_URI_DISK_PROFILE_UTILS_HPP__
19 
20 #include <mesos/mesos.hpp>
21 
22 #include <mesos/csi/v0.hpp>
23 
24 #include <stout/option.hpp>
25 #include <stout/try.hpp>
26 
27 // ONLY USEFUL AFTER RUNNING PROTOC.
28 #include "resource_provider/storage/disk_profile.pb.h"
29 
30 namespace mesos {
31 namespace internal {
32 namespace storage {
33 
34 // Helper for parsing a string as the expected data format.
36  const std::string& data);
37 
38 
39 // Helper for checking if a resource provider is selected for a profile.
41  const resource_provider::DiskProfileMapping::CSIManifest& profileManifest,
42  const ResourceProviderInfo& resourceProviderInfo);
43 
44 
45 // Checks the fields inside a `DiskProfileMapping` according to the
46 // comments above the protobuf.
47 Option<Error> validate(const resource_provider::DiskProfileMapping& mapping);
48 
49 
50 // Checks the fields inside a `VolumeCapability` according to the
51 // comments above the protobuf.
52 Option<Error> validate(const csi::v0::VolumeCapability& capability);
53 
54 } // namespace storage {
55 } // namespace internal {
56 } // namespace mesos {
57 
58 #endif // __RESOURCE_PROVIDER_URI_DISK_PROFILE_HPP__
Definition: check.hpp:33
Option< Error > validate(const resource_provider::DiskProfileMapping &mapping)
Try< resource_provider::DiskProfileMapping > parseDiskProfileMapping(const std::string &data)
Definition: agent.hpp:25
Definition: attributes.hpp:24
bool isSelectedResourceProvider(const resource_provider::DiskProfileMapping::CSIManifest &profileManifest, const ResourceProviderInfo &resourceProviderInfo)