package detector

import "k8s.io/kubernetes/Godeps/_workspace/src/github.com/mesos/mesos-go/detector"

The detector package houses implementation of master detectors. The default implementation is the zookeeper master detector. It uses zookeeper to detect the lead Mesos master during startup/failover.

Index

Variables

var (
	EmptySpecError = errors.New("empty master specification")
)

Functions

func CreateMasterInfo

func CreateMasterInfo(pid *upid.UPID) *mesos.MasterInfo

Super-useful utility func that attempts to build a mesos.MasterInfo from a upid.UPID specification. An attempt is made to determine the IP address of the UPID's Host and any errors during such resolution will result in a nil returned result. A nil result is also returned upon errors parsing the Port specification of the UPID.

TODO(jdef) make this a func of upid.UPID so that callers can invoke somePid.MasterInfo()?

func Register

func Register(prefix string, f PluginFactory) error

associates a plugin implementation with a Master specification prefix. packages that provide plugins are expected to invoke this func within their init() implementation. schedulers that wish to support plugins may anonymously import ("_") a package the auto-registers said plugins.

Types

type Master

type Master interface {
	// Detect new master election. Every time a new master is elected, the
	// detector will alert the observer. The first call to Detect is expected
	// to kickstart any background detection processing (and not before then).
	// If detection startup fails, or the listener cannot be added, then an
	// error is returned.
	Detect(MasterChanged) error

	// returns a chan that, when closed, indicates the detector has terminated
	Done() <-chan struct{}

	// cancel the detector. it's ok to call this multiple times, or even if
	// Detect() hasn't been invoked yet.
	Cancel()
}

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

func New

func New(spec string) (m Master, err error)

Create a new detector given the provided specification. Examples are:

Support for the file:// prefix is intentionally hardcoded so that it may not be inadvertently overridden by a custom plugin implementation. Custom plugins are supported via the Register and MatchingPlugin funcs.

Furthermore it is expected that master detectors returned from this func are not yet running and will only begin to spawn requisite background processing upon, or some time after, the first invocation of their Detect.

type MasterChanged

type MasterChanged interface {
	// Invoked when the master changes
	OnMasterChanged(*mesos.MasterInfo)
}

type OnMasterChanged

type OnMasterChanged func(*mesos.MasterInfo)

func/interface adapter

func (OnMasterChanged) OnMasterChanged

func (f OnMasterChanged) OnMasterChanged(mi *mesos.MasterInfo)

type PluginFactory

type PluginFactory func(string) (Master, error)

func MatchingPlugin

func MatchingPlugin(spec string) (PluginFactory, bool)

type Standalone

type Standalone struct {
	// contains filtered or unexported fields
}

func NewStandalone

func NewStandalone(mi *mesos.MasterInfo) *Standalone

Create a new stand alone master detector.

func (*Standalone) Cancel

func (s *Standalone) Cancel()

func (*Standalone) Detect

func (s *Standalone) Detect(o MasterChanged) error

Detecting the new master.

func (*Standalone) Done

func (s *Standalone) Done() <-chan struct{}

func (*Standalone) String

func (s *Standalone) String() string

Source Files

doc.go factory.go interface.go standalone.go

Directories

PathSynopsis
Godeps/_workspace/src/github.com/mesos/mesos-go/detector/zoo
Version
v0.18.1
Published
Jun 3, 2015
Platform
js/wasm
Imports
17 packages
Last checked
4 minutes ago

Tools for package owners.