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 ExecutorID devolve(const v1::ExecutorID& executorId);
58 FrameworkID devolve(const v1::FrameworkID& frameworkId);
59 FrameworkInfo devolve(const v1::FrameworkInfo& frameworkInfo);
60 HealthCheck devolve(const v1::HealthCheck& check);
61 InverseOffer devolve(const v1::InverseOffer& inverseOffer);
62 Offer devolve(const v1::Offer& offer);
63 OperationStatus devolve(const v1::OperationStatus& status);
64 Resource devolve(const v1::Resource& resource);
65 ResourceProviderID devolve(const v1::ResourceProviderID& resourceProviderId);
66 ResourceProviderInfo devolve(
67  const v1::ResourceProviderInfo& resourceProviderInfo);
68 Resources devolve(const v1::Resources& resources);
69 SlaveID devolve(const v1::AgentID& agentId);
70 SlaveInfo devolve(const v1::AgentInfo& agentInfo);
71 TaskID devolve(const v1::TaskID& taskId);
72 TaskStatus devolve(const v1::TaskStatus& status);
73 
76  const v1::resource_provider::Event& event);
77 
80 
83 
85 
87 
88 // Helper for repeated field devolving to 'T1' from 'T2'.
89 template <typename T1, typename T2>
90 google::protobuf::RepeatedPtrField<T1> devolve(
91  google::protobuf::RepeatedPtrField<T2> t2s)
92 {
93  google::protobuf::RepeatedPtrField<T1> t1s;
94 
95  foreach (const T2& t2, t2s) {
96  t1s.Add()->CopyFrom(devolve(t2));
97  }
98 
99  return t1s;
100 }
101 
102 } // namespace internal {
103 } // namespace mesos {
104 
105 #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:2611
mesos::v1::scheduler::Event Event
Definition: mesos.hpp:2612
CommandInfo devolve(const v1::CommandInfo &command)
Definition: spec.hpp:30
Definition: attributes.hpp:24