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 service containers of a CSI plugin instance.
52 {
53 public:
55  const process::http::URL& agentUrl,
56  const std::string& rootDir,
57  const CSIPluginInfo& info,
58  const hashset<Service>& services,
59  const std::string& containerPrefix,
60  const Option<std::string>& authToken,
61  const process::grpc::client::Runtime& runtime,
62  Metrics* metrics);
63 
64  // Since this class contains `Owned` members which should not but can be
65  // copied, explicitly make this class non-copyable.
66  //
67  // TODO(chhsiao): Remove this once MESOS-5122 is fixed.
68  ServiceManager(const ServiceManager&) = delete;
69  ServiceManager& operator=(const ServiceManager&) = delete;
70 
72 
74 
77 
78 private:
80  process::Future<Nothing> recovered;
81 };
82 
83 } // namespace csi {
84 } // namespace mesos {
85 
86 #endif // __CSI_SERVICE_MANAGER_HPP__
ServiceManager(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: 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
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)