Apache Mesos
weights.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 __MASTER_WEIGHTS_HPP__
18 #define __MASTER_WEIGHTS_HPP__
19 
20 #include <string>
21 
22 #include <mesos/mesos.hpp>
23 
24 #include <stout/error.hpp>
25 #include <stout/option.hpp>
26 #include <stout/try.hpp>
27 
28 #include "master/registrar.hpp"
29 #include "master/registry.hpp"
30 
31 namespace mesos {
32 namespace internal {
33 namespace master {
34 namespace weights {
35 
36 // We do not impose any constraints upon weights registry operations.
37 // It is up to the master to determine whether a weights update
38 // request is valid. Hence weights registry operations never fail (i.e.
39 // `perform()` never returns an `Error`). Note that this does not
40 // influence registry failures, e.g. a network partition may occur and
41 // will render the operation hanging (i.e. `Future` for the operation
42 // will not be set).
43 
51 {
52 public:
53  explicit UpdateWeights(const std::vector<WeightInfo>& _weightInfos);
54 
55 protected:
56  Try<bool> perform(Registry* registry, hashset<SlaveID>* slaveIDs);
57 
58 private:
59  const std::vector<WeightInfo> weightInfos;
60 };
61 
62 } // namespace weights {
63 } // namespace master {
64 } // namespace internal {
65 } // namespace mesos {
66 
67 #endif // __MASTER_WEIGHTS_HPP__
Definition: try.hpp:34
Try< bool > perform(Registry *registry, hashset< SlaveID > *slaveIDs)
UpdateWeights(const std::vector< WeightInfo > &_weightInfos)
Updates weights for the specified roles.
Definition: weights.hpp:50
Definition: registrar.hpp:45