Apache Mesos
resource_provider.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 __MESOS_V1_RESOURCE_PROVIDER_HPP__
18 #define __MESOS_V1_RESOURCE_PROVIDER_HPP__
19 
20 #include <functional>
21 #include <queue>
22 
23 #include <process/future.hpp>
24 #include <process/http.hpp>
25 #include <process/owned.hpp>
26 
27 #include <mesos/http.hpp>
28 
29 #include <mesos/v1/mesos.hpp>
30 
32 
33 #include <stout/nothing.hpp>
34 #include <stout/option.hpp>
35 
36 namespace mesos {
37 namespace internal {
38 
39 // Forward declarations.
40 template <typename Call, typename Event>
42 
43 class EndpointDetector;
44 
45 } // namespace internal {
46 
47 namespace v1 {
48 namespace resource_provider {
49 
50 typedef ::mesos::internal::HttpConnectionProcess<Call, Event> DriverProcess;
51 
52 
56 class Driver
57 {
58 public:
79  ContentType contentType,
80  const std::function<void(void)>& connected,
81  const std::function<void(void)>& disconnected,
82  const std::function<void(const std::queue<Event>&)>& received,
83  const Option<Credential>& credential);
84 
85  ~Driver();
86 
87  void start() const;
88 
89  Driver(const Driver& other) = delete;
90  Driver& operator=(const Driver& other) = delete;
91 
92  process::Future<Nothing> send(const Call& call);
93 
94 private:
96 };
97 
98 } // namespace resource_provider {
99 } // namespace v1 {
100 } // namespace mesos {
101 
102 #endif // __MESOS_V1_RESOURCE_PROVIDER_HPP__
process::Future< Nothing > send(const Call &call)
ContentType
Definition: http.hpp:43
Driver & operator=(const Driver &other)=delete
mesos::v1::scheduler::Call Call
Definition: mesos.hpp:2564
HTTP connection handler.
Definition: resource_provider.hpp:41
Definition: detector.hpp:26
::mesos::internal::HttpConnectionProcess< Call, Event > DriverProcess
Definition: resource_provider.hpp:50
Resource provider driver.
Definition: resource_provider.hpp:56
Driver(process::Owned< mesos::internal::EndpointDetector > detector, ContentType contentType, const std::function< void(void)> &connected, const std::function< void(void)> &disconnected, const std::function< void(const std::queue< Event > &)> &received, const Option< Credential > &credential)
Construct a Driver.