Apache Mesos
devolve.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 __INTERNAL_DEVOLVE_HPP__
18 #define __INTERNAL_DEVOLVE_HPP__
19 
20 #include <google/protobuf/message.h>
21 
22 #include <mesos/agent/agent.hpp>
23 
24 #include <mesos/mesos.hpp>
25 #include <mesos/resources.hpp>
26 
28 
29 #include <mesos/master/master.hpp>
30 
32 
34 
35 #include <mesos/v1/mesos.hpp>
36 #include <mesos/v1/resources.hpp>
37 
38 #include <mesos/v1/agent/agent.hpp>
39 
41 
43 
45 
47 
48 #include <stout/foreach.hpp>
49 
50 namespace mesos {
51 namespace internal {
52 
53 // Helpers for devolving types between versions. Please add as necessary!
54 CommandInfo devolve(const v1::CommandInfo& command);
55 ContainerID devolve(const v1::ContainerID& containerId);
56 Credential devolve(const v1::Credential& credential);
57 DrainConfig devolve(const v1::DrainConfig& drainConfig);
58 DrainInfo devolve(const v1::DrainInfo& drainInfo);
59 DurationInfo devolve(const google::protobuf::Duration& duration);
60 ExecutorID devolve(const v1::ExecutorID& executorId);
61 FrameworkID devolve(const v1::FrameworkID& frameworkId);
62 FrameworkInfo devolve(const v1::FrameworkInfo& frameworkInfo);
63 HealthCheck devolve(const v1::HealthCheck& check);
64 InverseOffer devolve(const v1::InverseOffer& inverseOffer);
65 Offer devolve(const v1::Offer& offer);
67 OperationStatus devolve(const v1::OperationStatus& status);
68 Resource devolve(const v1::Resource& resource);
69 ResourceProviderID devolve(const v1::ResourceProviderID& resourceProviderId);
70 ResourceProviderInfo devolve(
71  const v1::ResourceProviderInfo& resourceProviderInfo);
72 Resources devolve(const v1::Resources& resources);
73 SlaveID devolve(const v1::AgentID& agentId);
74 SlaveInfo devolve(const v1::AgentInfo& agentInfo);
75 TaskID devolve(const v1::TaskID& taskId);
76 TaskStatus devolve(const v1::TaskStatus& status);
77 
80  const v1::resource_provider::Event& event);
81 
84 
87 
90 
92 
93 // Helper for repeated field devolving to 'T1' from 'T2'.
94 template <typename T1, typename T2>
95 google::protobuf::RepeatedPtrField<T1> devolve(
96  google::protobuf::RepeatedPtrField<T2> t2s)
97 {
98  google::protobuf::RepeatedPtrField<T1> t1s;
99 
100  foreach (const T2& t2, t2s) {
101  t1s.Add()->CopyFrom(devolve(t2));
102  }
103 
104  return t1s;
105 }
106 
107 } // namespace internal {
108 } // namespace mesos {
109 
110 #endif // __INTERNAL_DEVOLVE_HPP__
Try< Nothing > check()
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
mesos::v1::scheduler::Call Call
Definition: mesos.hpp:2851
Operation
Definition: cgroups.hpp:444
mesos::v1::scheduler::Event Event
Definition: mesos.hpp:2852
CommandInfo devolve(const v1::CommandInfo &command)
Definition: agent.hpp:25
Definition: attributes.hpp:24
mesos::v1::scheduler::Response Response
Definition: mesos.hpp:2854