Apache Mesos
|
An abstraction for contending to be a leading master. More...
#include <contender.hpp>
Public Member Functions | |
virtual | ~MasterContender ()=0 |
Note that the contender's membership, if obtained, is scheduled to be cancelled during destruction. More... | |
virtual void | initialize (const MasterInfo &masterInfo)=0 |
Initializes the contender with the MasterInfo of the master it contends on behalf of. More... | |
virtual process::Future< process::Future< Nothing > > | contend ()=0 |
Returns a Future<Nothing> once the contender has entered the contest (by obtaining a membership) and an error otherwise. More... | |
Static Public Member Functions | |
static Try< MasterContender * > | create (const Option< std::string > &zk, const Option< std::string > &masterContenderModule=None(), const Option< Duration > &zkSessionTimeout=None()) |
Creates a master contender. More... | |
An abstraction for contending to be a leading master.
TODO(benh): Support contending with a v1::MasterInfo.
|
pure virtual |
Note that the contender's membership, if obtained, is scheduled to be cancelled during destruction.
|
pure virtual |
Returns a Future<Nothing> once the contender has entered the contest (by obtaining a membership) and an error otherwise.
A failed future is returned if this method is called before initialize(). The inner Future returns Nothing when the contender is out of the contest (i.e. its membership is lost).
This method can be used to contend again after candidacy is obtained (the outer future satisfied), otherwise the future for the pending election is returned. Recontending after candidacy is obtained causes the previous candidacy to be withdrawn.
Implemented in mesos::master::contender::ZooKeeperMasterContender, and mesos::master::contender::StandaloneMasterContender.
|
static |
Creates a master contender.
If masterContenderModule
contains a valid module name (that is, a name that matches the name specified in a JSON file/string passed into the command-line invocations using the --modules
flag). Additional parameters required to create an object of the contender type are expected to be specified in the JSON's parameter
object. In command-line invocations, the value of masterContenderModule
is expected to come from the --master_contender
flag.
If masterContenderModule
is None
, zk
is checked and if it contains a valid zk://
or file://
path (passed in using the --zk
flag), an instance of ZooKeeperMasterContender is returned.
If both arguments are None
, StandaloneMasterDetector
is returned.
Note that the returned contender still needs to be initialize()
d.
|
pure virtual |
Initializes the contender with the MasterInfo of the master it contends on behalf of.
Implemented in mesos::master::contender::ZooKeeperMasterContender, and mesos::master::contender::StandaloneMasterContender.