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 
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/state.hpp"
43 #include "csi/volume_manager.hpp"
44 
45 namespace mesos {
46 namespace csi {
47 namespace v1 {
48 
49 // Forward declarations.
50 class VolumeManagerProcess;
51 
52 
54 {
55 public:
57  const std::string& rootDir,
58  const CSIPluginInfo& info,
59  const hashset<Service>& services,
60  const process::grpc::client::Runtime& runtime,
61  ServiceManager* serviceManager,
63  SecretResolver* secretResolver);
64 
65  // Since this class contains `Owned` members which should not but can be
66  // copied, explicitly make this class non-copyable.
67  //
68  // TODO(chhsiao): Remove this once MESOS-5122 is fixed.
69  VolumeManager(const VolumeManager&) = delete;
70  VolumeManager& operator=(const VolumeManager&) = delete;
71 
72  ~VolumeManager() override;
73 
75 
77 
79  const Volume::Source::CSIVolume::VolumeCapability& capability,
80  const google::protobuf::Map<std::string, std::string>& parameters)
81  override;
82 
84  const std::string& name,
85  const Bytes& capacity,
86  const Volume::Source::CSIVolume::VolumeCapability& capability,
87  const google::protobuf::Map<std::string, std::string>& parameters)
88  override;
89 
91  const VolumeInfo& volumeInfo,
92  const Volume::Source::CSIVolume::VolumeCapability& capability,
93  const google::protobuf::Map<std::string, std::string>& parameters)
94  override;
95 
96  process::Future<bool> deleteVolume(const std::string& volumeId) override;
97 
98  process::Future<Nothing> attachVolume(const std::string& volumeId) override;
99 
100  process::Future<Nothing> detachVolume(const std::string& volumeId) override;
101 
103  const std::string& volumeId,
104  const Option<state::VolumeState>& volumeState = None()) override;
105 
107  const std::string& volumeId) override;
108 
109 private:
111  process::Future<Nothing> recovered;
112 };
113 
114 } // namespace v1 {
115 } // namespace csi {
116 } // namespace mesos {
117 
118 #endif // __CSI_V1_VOLUME_MANAGER_HPP__
Definition: volume_manager.hpp:57
Definition: option.hpp:29
Definition: v1_volume_manager.hpp:53
VolumeManager(const std::string &rootDir, const CSIPluginInfo &info, const hashset< Service > &services, const process::grpc::client::Runtime &runtime, ServiceManager *serviceManager, Metrics *metrics, SecretResolver *secretResolver)
Definition: volume_manager.hpp:48
process::Future< VolumeInfo > createVolume(const std::string &name, const Bytes &capacity, const Volume::Source::CSIVolume::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override
process::Future< Bytes > getCapacity(const Volume::Source::CSIVolume::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override
Definition: metrics.hpp:28
Definition: v0.hpp:49
process::Future< Nothing > publishVolume(const std::string &volumeId, const Option< state::VolumeState > &volumeState=None()) override
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
Definition: none.hpp:27
process::Future< Nothing > detachVolume(const std::string &volumeId) override
Definition: executor.hpp:48
process::Future< Nothing > recover() override
Definition: resolver.hpp:34
Definition: bytes.hpp:30
Definition: owned.hpp:36
Definition: service_manager.hpp:51
PID< MetricsProcess > metrics
constexpr const char * name
Definition: shell.hpp:41
process::Future< bool > deleteVolume(const std::string &volumeId) override
process::Future< Option< Error > > validateVolume(const VolumeInfo &volumeInfo, const Volume::Source::CSIVolume::VolumeCapability &capability, const google::protobuf::Map< std::string, std::string > &parameters) override
process::Future< Nothing > attachVolume(const std::string &volumeId) override
VolumeManager & operator=(const VolumeManager &)=delete
process::Future< std::vector< VolumeInfo > > listVolumes() override