Apache Mesos
zookeeper.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_ZOOKEEPER_HPP__
18 #define __MASTER_CONTENDER_ZOOKEEPER_HPP__
19 
20 #include <mesos/mesos.hpp>
21 
23 
25 #include <mesos/zookeeper/url.hpp>
26 
27 #include <process/future.hpp>
28 #include <process/owned.hpp>
29 
30 #include <stout/nothing.hpp>
31 
32 namespace mesos {
33 namespace master {
34 namespace contender {
35 
37 
38 
39 class ZooKeeperMasterContenderProcess;
40 
41 
43 {
44 public:
45  // Creates a contender that uses ZooKeeper to determine (i.e.,
46  // elect) a leading master.
47  explicit ZooKeeperMasterContender(
48  const zookeeper::URL& url,
49  const Duration& sessionTimeout = MASTER_CONTENDER_ZK_SESSION_TIMEOUT);
50 
52 
53  ~ZooKeeperMasterContender() override;
54 
55  // MasterContender implementation.
56  void initialize(const MasterInfo& masterInfo) override;
58 
59 private:
60  ZooKeeperMasterContenderProcess* process;
61 };
62 
63 } // namespace contender {
64 } // namespace master {
65 } // namespace mesos {
66 
67 #endif // __MASTER_CONTENDER_ZOOKEEPER_HPP__
const Duration MASTER_CONTENDER_ZK_SESSION_TIMEOUT
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 ...
Definition: duration.hpp:32
void initialize(const MasterInfo &masterInfo) override
Initializes the contender with the MasterInfo of the master it contends on behalf of...
An abstraction for contending to be a leading master.
Definition: contender.hpp:40
Definition: agent.hpp:25
Definition: grp.hpp:26
ZooKeeperMasterContender(const zookeeper::URL &url, const Duration &sessionTimeout=MASTER_CONTENDER_ZK_SESSION_TIMEOUT)
Definition: executor.hpp:48
Definition: url.hpp:46
Definition: owned.hpp:36
Definition: future.hpp:58