Apache Mesos
compatibility.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 __SLAVE_COMPATIBILITY_HPP__
18 #define __SLAVE_COMPATIBILITY_HPP__
19 
20 #include <stout/nothing.hpp>
21 #include <stout/try.hpp>
22 
23 #include <mesos/mesos.pb.h>
24 
25 namespace mesos {
26 namespace internal {
27 namespace slave {
28 namespace compatibility {
29 
30 // This function checks whether `previous` and `current` are considered to be
31 // "equal", i.e., all fields in `SlaveInfo` are the same.
33  const SlaveInfo& previous,
34  const SlaveInfo& current);
35 
36 
37 // This function checks whether the changes between `previous` and `current`
38 // are considered to be "additive", according to the rules in the following
39 // table:
40 //
41 // Field | Constraint
42 // -----------------------------------------------------------------------------
43 // hostname | Must match exactly.
44 // port | Must match exactly.
45 // domain | Must either match exactly or change from not configured to
46 // | configured.
47 // resources | All previous resources must be present with the same type.
48 // | For type SCALAR: The new value must be not smaller than the old.
49 // | For type RANGE: The new value must include the old ranges.
50 // | For type SET: The new value must be a superset of the old.
51 // | New resources are permitted. In the presence of reservations,
52 // | these rules are applied per role.
53 // attributes | All previous attributes must be present with the same type.
54 // | For type SCALAR: The new value must be not smaller than the old.
55 // | For type RANGE: The new value must include the old ranges.
56 // | For type TEXT: The new value must exactly match the previous.
57 // | New attributes are permitted.
58 //
60  const SlaveInfo& previous,
61  const SlaveInfo& current);
62 
63 } // namespace compatibility {
64 } // namespace slave {
65 } // namespace internal {
66 } // namespace mesos {
67 
68 #endif // __SLAVE_COMPATIBILITY_HPP__
Try< Nothing > equal(const SlaveInfo &previous, const SlaveInfo &current)
Definition: check.hpp:33
Try< Nothing > additive(const SlaveInfo &previous, const SlaveInfo &current)
Definition: agent.hpp:25
Definition: attributes.hpp:24