Apache Mesos
Public Member Functions | Static Public Member Functions | List of all members
mesos::master::contender::MasterContender Class Referenceabstract

An abstraction for contending to be a leading master. More...

#include <contender.hpp>

Inheritance diagram for mesos::master::contender::MasterContender:
mesos::master::contender::StandaloneMasterContender mesos::master::contender::ZooKeeperMasterContender

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...
 

Detailed Description

An abstraction for contending to be a leading master.

TODO(benh): Support contending with a v1::MasterInfo.

Constructor & Destructor Documentation

virtual mesos::master::contender::MasterContender::~MasterContender ( )
pure virtual

Note that the contender's membership, if obtained, is scheduled to be cancelled during destruction.

Member Function Documentation

virtual process::Future<process::Future<Nothing> > mesos::master::contender::MasterContender::contend ( )
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 Try<MasterContender*> mesos::master::contender::MasterContender::create ( const Option< std::string > &  zk,
const Option< std::string > &  masterContenderModule = None(),
const Option< Duration > &  zkSessionTimeout = None() 
)
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.

virtual void mesos::master::contender::MasterContender::initialize ( const MasterInfo &  masterInfo)
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.


The documentation for this class was generated from the following file: