Apache Mesos
standalone.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_CONTENDER_STANDALONE_HPP__
18 #define __MASTER_CONTENDER_STANDALONE_HPP__
19 
20 #include <mesos/mesos.hpp>
21 
23 
24 #include <process/future.hpp>
25 
26 #include <stout/nothing.hpp>
27 
28 namespace mesos {
29 namespace master {
30 namespace contender {
31 
32 // A basic implementation which assumes only one master is
33 // contending.
35 {
36 public:
38  : initialized(false),
39  promise(nullptr) {}
40 
41  ~StandaloneMasterContender() override;
42 
43  // MasterContender implementation.
44  void initialize(const MasterInfo& masterInfo) override;
45 
46  // In this basic implementation the outer Future directly returns
47  // and inner Future stays pending because there is only one
48  // contender in the contest.
50 
51 private:
52  bool initialized;
54 };
55 
56 } // namespace contender {
57 } // namespace master {
58 } // namespace mesos {
59 
60 #endif // __MASTER_CONTENDER_STANDALONE_HPP__
Definition: master.hpp:27
process::Future< process::Future< Nothing > > contend() override
Returns a Future<Nothing> once the contender has entered the contest (by obtaining a membership) and ...
StandaloneMasterContender()
Definition: standalone.hpp:37
An abstraction for contending to be a leading master.
Definition: contender.hpp:40
Definition: agent.hpp:25
void initialize(const MasterInfo &masterInfo) override
Initializes the contender with the MasterInfo of the master it contends on behalf of...
Definition: future.hpp:58