Apache Mesos
service_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_SERVICE_MANAGER_HPP__
18 #define __CSI_SERVICE_MANAGER_HPP__
19 
20 #include <string>
21 
22 #include <mesos/mesos.hpp>
23 
24 #include <process/future.hpp>
25 #include <process/grpc.hpp>
26 #include <process/http.hpp>
27 #include <process/owned.hpp>
28 
29 #include <stout/hashset.hpp>
30 #include <stout/nothing.hpp>
31 #include <stout/option.hpp>
32 
33 #include "csi/metrics.hpp"
34 
35 namespace mesos {
36 namespace csi {
37 
39 
42 
44 
45 
46 // Forward declarations.
47 class ServiceManagerProcess;
48 
49 
50 // Manages the services of a CSI plugin instance.
52 {
53 public:
54  // This is for the managed CSI plugins which will be
55  // launched as standalone containers.
57  const SlaveID& agentId,
58  const process::http::URL& agentUrl,
59  const std::string& rootDir,
60  const CSIPluginInfo& info,
61  const hashset<Service>& services,
62  const std::string& containerPrefix,
63  const Option<std::string>& authToken,
64  const process::grpc::client::Runtime& runtime,
65  Metrics* metrics);
66 
67  // This is for the unmanaged CSI plugins which we assume
68  // are already launched out of Mesos.
70  const CSIPluginInfo& info,
71  const hashset<Service>& services,
72  const process::grpc::client::Runtime& runtime,
73  Metrics* metrics);
74 
75  // Since this class contains `Owned` members which should not but can be
76  // copied, explicitly make this class non-copyable.
77  //
78  // TODO(chhsiao): Remove this once MESOS-5122 is fixed.
79  ServiceManager(const ServiceManager&) = delete;
80  ServiceManager& operator=(const ServiceManager&) = delete;
81 
83 
85 
88 
89 private:
91  process::Future<Nothing> recovered;
92 };
93 
94 } // namespace csi {
95 } // namespace mesos {
96 
97 #endif // __CSI_SERVICE_MANAGER_HPP__
Definition: metrics.hpp:28
Definition: v0.hpp:49
constexpr Service CONTROLLER_SERVICE
Definition: service_manager.hpp:40
process::Future< std::string > getApiVersion()
Definition: http.hpp:130
A copyable interface to manage an internal runtime process for asynchronous gRPC calls.
Definition: grpc.hpp:157
Definition: agent.hpp:25
constexpr Service NODE_SERVICE
Definition: service_manager.hpp:43
ServiceManager(const SlaveID &agentId, const process::http::URL &agentUrl, const std::string &rootDir, const CSIPluginInfo &info, const hashset< Service > &services, const std::string &containerPrefix, const Option< std::string > &authToken, const process::grpc::client::Runtime &runtime, Metrics *metrics)
Definition: executor.hpp:48
CSIPluginContainerInfo::Service Service
Definition: service_manager.hpp:38
ServiceManager & operator=(const ServiceManager &)=delete
process::Future< Nothing > recover()
Definition: service_manager.hpp:51
PID< MetricsProcess > metrics
process::Future< std::string > getServiceEndpoint(const Service &service)