Apache Mesos
maintenance.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_MASTER_MAINTENANCE_HPP__
18 #define __MESOS_MASTER_MAINTENANCE_HPP__
19 
20 #include <mesos/mesos.hpp>
21 
23 
24 #include <stout/hashset.hpp>
25 #include <stout/nothing.hpp>
26 #include <stout/try.hpp>
27 
28 #include "master/machine.hpp"
29 #include "master/registrar.hpp"
30 #include "master/registry.hpp"
31 
32 namespace mesos {
33 namespace internal {
34 namespace master {
35 namespace maintenance {
36 
37 // Maintenance registry operations will never report a failure while
38 // performing the operation (i.e. `perform` never returns an `Error`).
39 // This means the underlying `Future` for the operation will always be
40 // set to true. If there is a separate failure, such as a network
41 // partition, while performing the operation, this future will not be set.
42 
51 {
52 public:
53  explicit UpdateSchedule(
54  const mesos::maintenance::Schedule& _schedule);
55 
56 protected:
57  Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) override;
58 
59 private:
60  const mesos::maintenance::Schedule schedule;
61 };
62 
63 
72 {
73 public:
74  explicit StartMaintenance(
75  const google::protobuf::RepeatedPtrField<MachineID>& _ids);
76 
77 protected:
78  Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) override;
79 
80 private:
82 };
83 
84 
92 {
93 public:
94  explicit StopMaintenance(
95  const google::protobuf::RepeatedPtrField<MachineID>& _ids);
96 
97 protected:
98  Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs) override;
99 
100 private:
101  hashset<MachineID> ids;
102 };
103 
104 
105 namespace validation {
106 
116  const mesos::maintenance::Schedule& schedule,
118 
119 
120 // Checks that the `duration` of the unavailability is non-negative.
122  const Unavailability& unavailability);
123 
124 
131 Try<Nothing> machines(const google::protobuf::RepeatedPtrField<MachineID>& ids);
132 
133 
139 Try<Nothing> machine(const MachineID& id);
140 
141 } // namespace validation {
142 } // namespace maintenance {
143 } // namespace master {
144 } // namespace internal {
145 } // namespace mesos {
146 
147 #endif // __MESOS_MASTER_MAINTENANCE_HPP__
Definition: master.hpp:27
Definition: check.hpp:33
Try< Nothing > machines(const google::protobuf::RepeatedPtrField< MachineID > &ids)
Performs the following checks on a list of machines:
Try< bool > perform(Registry *registry, hashset< SlaveID > *slaveIDs) override
Transitions a group of machines from DOWN mode into UP mode.
Definition: maintenance.hpp:91
Definition: hashmap.hpp:38
Try< Nothing > unavailability(const Unavailability &unavailability)
Definition: agent.hpp:25
Try< Nothing > machine(const MachineID &id)
Performs the following checks on a single machine:
Definition: attributes.hpp:24
UpdateSchedule(const mesos::maintenance::Schedule &_schedule)
Definition: registrar.hpp:45
Updates the maintanence schedule of the cluster.
Definition: maintenance.hpp:50
Transitions a group of machines from DRAINING mode into DOWN mode.
Definition: maintenance.hpp:71
Try< Nothing > schedule(const mesos::maintenance::Schedule &schedule, const hashmap< MachineID, Machine > &machines)
Performs the following checks on the new maintenance schedule: