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:
80  ContentType contentType,
81  const std::function<void(void)>& connected,
82  const std::function<void(void)>& disconnected,
83  const std::function<void(const std::queue<Event>&)>& received,
84  const Option<std::string>& token);
85 
86  ~Driver();
87 
88  void start() const;
89 
90  Driver(const Driver& other) = delete;
91  Driver& operator=(const Driver& other) = delete;
92 
93  process::Future<Nothing> send(const Call& call);
94 
95 private:
97 };
98 
99 } // namespace resource_provider {
100 } // namespace v1 {
101 } // namespace mesos {
102 
103 #endif // __MESOS_V1_RESOURCE_PROVIDER_HPP__
ContentType
Definition: http.hpp:43
mesos::v1::scheduler::Call Call
Definition: mesos.hpp:2851
HTTP connection handler.
Definition: resource_provider.hpp:41
Definition: detector.hpp:26
::mesos::internal::HttpConnectionProcess< Call, Event > DriverProcess
Definition: resource_provider.hpp:50
Try< Nothing > start(const std::string &name)
Starts the slice with the given name (via &#39;systemctl start <name>&#39;).
Resource provider driver.
Definition: resource_provider.hpp:56
Definition: agent.hpp:25
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
Definition: attributes.hpp:24
Future< size_t > send(const int_fd &fd, const void *buf, size_t size)