Apache Mesos
v0_v1executor.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 __V0_V1EXECUTOR_HPP__
18 #define __V0_V1EXECUTOR_HPP__
19 
20 #include <functional>
21 #include <string>
22 
23 #include <mesos/executor.hpp>
24 #include <mesos/mesos.hpp>
25 
26 #include <mesos/v1/executor.hpp>
27 
28 #include <process/owned.hpp>
29 
30 namespace mesos {
31 namespace v1 {
32 namespace executor {
33 
34 class V0ToV1AdapterProcess; // Forward declaration.
35 
36 // This interface acts as an adapter from the v0 (driver + executor) to the
37 // v1 Mesos executor.
38 class V0ToV1Adapter : public mesos::Executor, public MesosBase
39 {
40 public:
42  const std::function<void(void)>& connected,
43  const std::function<void(void)>& disconnected,
44  const std::function<void(const std::queue<Event>&)>& received);
45 
46  ~V0ToV1Adapter() override;
47 
48  void registered(
49  ExecutorDriver* driver,
50  const mesos::ExecutorInfo& executorInfo,
51  const mesos::FrameworkInfo& frameworkInfo,
52  const mesos::SlaveInfo& slaveInfo) override;
53 
54  void reregistered(
55  ExecutorDriver* driver,
56  const mesos::SlaveInfo& slaveInfo) override;
57 
58  void launchTask(
59  ExecutorDriver* driver,
60  const mesos::TaskInfo& task) override;
61 
62  void disconnected(ExecutorDriver* driver) override;
63 
64  void killTask(
65  ExecutorDriver* driver,
66  const mesos::TaskID& taskId) override;
67 
68  void frameworkMessage(
69  ExecutorDriver* driver,
70  const std::string& data) override;
71 
72  void shutdown(ExecutorDriver* driver) override;
73 
74  void error(
75  ExecutorDriver* driver,
76  const std::string& message) override;
77 
78  void send(const Call& call) override;
79 
80 private:
82  MesosExecutorDriver driver;
83 };
84 
85 } // namespace executor {
86 } // namespace v1 {
87 } // namespace mesos {
88 
89 #endif // __V0_V1EXECUTOR_HPP__
void killTask(ExecutorDriver *driver, const mesos::TaskID &taskId) override
Definition: v0_v1executor.hpp:38
void reregistered(ExecutorDriver *driver, const mesos::SlaveInfo &slaveInfo) override
Definition: executor.hpp:147
mesos::v1::scheduler::Call Call
Definition: mesos.hpp:2851
Definition: executor.hpp:212
void frameworkMessage(ExecutorDriver *driver, const std::string &data) override
void error(ExecutorDriver *driver, const std::string &message) override
Definition: agent.hpp:25
V0ToV1Adapter(const std::function< void(void)> &connected, const std::function< void(void)> &disconnected, const std::function< void(const std::queue< Event > &)> &received)
void shutdown(ExecutorDriver *driver) override
void launchTask(ExecutorDriver *driver, const mesos::TaskInfo &task) override
Definition: executor.hpp:75
Definition: executor.hpp:48
Definition: executor.hpp:39
void disconnected(ExecutorDriver *driver) override
void registered(ExecutorDriver *driver, const mesos::ExecutorInfo &executorInfo, const mesos::FrameworkInfo &frameworkInfo, const mesos::SlaveInfo &slaveInfo) override
void send(const Call &call) override