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

An abstraction of a Master detector which can be used to detect the leading master from a group. More...

#include <detector.hpp>

Inheritance diagram for mesos::master::detector::MasterDetector:
mesos::master::detector::StandaloneMasterDetector mesos::master::detector::ZooKeeperMasterDetector

Public Member Functions

virtual ~MasterDetector ()=0
 
virtual process::Future
< Option< MasterInfo > > 
detect (const Option< MasterInfo > &previous=None())=0
 Returns MasterInfo after an election has occurred and the elected master is different than that specified (if any), or NONE if an election occurs and no master is elected (e.g., all masters are lost). More...
 

Static Public Member Functions

static Try< MasterDetector * > create (const Option< std::string > &zk, const Option< std::string > &masterDetectorModule=None(), const Option< Duration > &zkSessionTimeout=None())
 Creates a master detector. More...
 

Detailed Description

An abstraction of a Master detector which can be used to detect the leading master from a group.

Constructor & Destructor Documentation

virtual mesos::master::detector::MasterDetector::~MasterDetector ( )
pure virtual

Member Function Documentation

static Try<MasterDetector*> mesos::master::detector::MasterDetector::create ( const Option< std::string > &  zk,
const Option< std::string > &  masterDetectorModule = None(),
const Option< Duration > &  zkSessionTimeout = None() 
)
static

Creates a master detector.

If masterDetectorModule contains a valid module name (that is, a name that matches the name specified in a JSON file/string passed into the command-line invocation using the --modules flag), the result is the MasterDetector returned by the module. Additional parameters required to create an object of the detector type are expected to be specified in the JSON's parameter object. In command-line invocations, the value of masterDetectorModule is expected to come from the --master_detector flag.

If masterDetectorModule is None, zk is checked and if it contains a valid zk:// or file:// path (passed in using the --master flag), an instance of ZooKeeperMasterDetector is returned.

If both arguments are None, StandaloneMasterDetector is returned.

virtual process::Future<Option<MasterInfo> > mesos::master::detector::MasterDetector::detect ( const Option< MasterInfo > &  previous = None())
pure virtual

Returns MasterInfo after an election has occurred and the elected master is different than that specified (if any), or NONE if an election occurs and no master is elected (e.g., all masters are lost).

A failed future is returned if the detector is unable to detect the leading master due to a non-retryable error. Note that the detector transparently tries to recover from retryable errors. The future is never discarded unless it stays pending when the detector destructs.

The 'previous' result (if any) should be passed back if this method is called repeatedly so the detector only returns when it gets a different result.

Implemented in mesos::master::detector::ZooKeeperMasterDetector, and mesos::master::detector::StandaloneMasterDetector.


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