Apache Mesos
v1_volume_manager.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 __CSI_V1_VOLUME_MANAGER_HPP__
18 #define __CSI_V1_VOLUME_MANAGER_HPP__
19 
20 #include <string>
21 #include <vector>
22 
23 #include <google/protobuf/map.h>
24 
25 #include <mesos/mesos.hpp>
26 
27 #include <mesos/csi/types.hpp>
28 
29 #include <process/future.hpp>
30 #include <process/grpc.hpp>
31 #include <process/http.hpp>
32 #include <process/owned.hpp>
33 
34 #include <stout/bytes.hpp>
35 #include <stout/error.hpp>
36 #include <stout/hashset.hpp>
37 #include <stout/nothing.hpp>
38 #include <stout/option.hpp>
39 
40 #include "csi/metrics.hpp"
41 #include "csi/service_manager.hpp"
42 #include "csi/volume_manager.hpp"
43 
44 namespace mesos {
45 namespace csi {
46 namespace v1 {
47 
48 // Forward declarations.
49 class VolumeManagerProcess;
50 
51 
53 {
54 public:
56  const std::string& rootDir,
57  const CSIPluginInfo& info,
58  const hashset<Service>& services,
59  const process::grpc::client::Runtime& runtime,
60  ServiceManager* serviceManager,
61  Metrics* metrics);
62 
63  // Since this class contains `Owned` members which should not but can be
64  // copied, explicitly make this class non-copyable.
65  //
66  // TODO(chhsiao): Remove this once MESOS-5122 is fixed.
67  VolumeManager(const VolumeManager&) = delete;
68  VolumeManager& operator=(const VolumeManager&) = delete;
69 
70  ~VolumeManager() override;
71 
73 
75 
77  const types::VolumeCapability& capability,
78  const google::protobuf::Map<std::string, std::string>& parameters)
79  override;
80 
82  const std::string& name,
83  const Bytes& capacity,
84  const types::VolumeCapability& capability,
85  const google::protobuf::Map<std::string, std::string>& parameters)
86  override;
87 
89  const VolumeInfo& volumeInfo,
90  const types::VolumeCapability& capability,
91  const google::protobuf::Map<std::string, std::string>& parameters)
92  override;
93 
94  process::Future<bool> deleteVolume(const std::string& volumeId) override;
95 
96  process::Future<Nothing> attachVolume(const std::string& volumeId) override;
97 
98  process::Future<Nothing> detachVolume(const std::string& volumeId) override;
99 
100  process::Future<Nothing> publishVolume(const std::string& volumeId) override;
101 
103  const std::string& volumeId) override;
104 
105 private:
107  process::Future<Nothing> recovered;
108 };
109 
110 } // namespace v1 {
111 } // namespace csi {
112 } // namespace mesos {
113 
114 #endif // __CSI_V1_VOLUME_MANAGER_HPP__
Definition: volume_manager.hpp:56
process::Future< Bytes > getCapacity(const types::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override
process::Future< Nothing > publishVolume(const std::string &volumeId) override
VolumeManager(const std::string &rootDir, const CSIPluginInfo &info, const hashset< Service > &services, const process::grpc::client::Runtime &runtime, ServiceManager *serviceManager, Metrics *metrics)
Definition: v1_volume_manager.hpp:52
Definition: volume_manager.hpp:47
Definition: metrics.hpp:28
Definition: v0.hpp:49
A copyable interface to manage an internal runtime process for asynchronous gRPC calls.
Definition: grpc.hpp:157
Definition: agent.hpp:25
process::Future< Nothing > unpublishVolume(const std::string &volumeId) override
process::Future< Nothing > detachVolume(const std::string &volumeId) override
Definition: executor.hpp:48
process::Future< VolumeInfo > createVolume(const std::string &name, const Bytes &capacity, const types::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override
process::Future< Nothing > recover() override
Definition: bytes.hpp:30
Definition: owned.hpp:36
Definition: service_manager.hpp:51
PID< MetricsProcess > metrics
constexpr const char * name
Definition: shell.hpp:43
process::Future< bool > deleteVolume(const std::string &volumeId) override
process::Future< Nothing > attachVolume(const std::string &volumeId) override
VolumeManager & operator=(const VolumeManager &)=delete
process::Future< std::vector< VolumeInfo > > listVolumes() override
process::Future< Option< Error > > validateVolume(const VolumeInfo &volumeInfo, const types::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override