Documentation ¶
Overview ¶
Zookeeper-based mesos-master leaderhip detection. Implements support for optional detector.AllMasters interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChildWatcher ¶
interface for handling watcher event when zk.EventNodeChildrenChanged.
type Connector ¶
type Connector interface { Close() Children(string) ([]string, *zk.Stat, error) ChildrenW(string) ([]string, *zk.Stat, <-chan zk.Event, error) Get(string) ([]byte, *zk.Stat, error) }
Connector Interface to facade zk.Conn type since github.com/samuel/go-zookeeper/zk does not provide an interface for the zk.Conn object, this allows for mocking and easier testing.
type ErrorHandler ¶
interface for handling errors (session and watch related).
type Factory ¶
type Factory interface {
// contains filtered or unexported methods
}
Factory is an adapter to trap the creation of zk.Conn instances since the official zk API does not expose an interface for zk.Conn.
type MasterDetector ¶
type MasterDetector struct {
// contains filtered or unexported fields
}
Detector uses ZooKeeper to detect new leading master.
func NewMasterDetector ¶
func NewMasterDetector(zkurls string) (*MasterDetector, error)
Internal constructor function
func (*MasterDetector) Cancel ¶
func (md *MasterDetector) Cancel()
func (*MasterDetector) Detect ¶
func (md *MasterDetector) Detect(f detector.MasterChanged) (err error)
the first call to Detect will kickstart a connection to zookeeper. a nil change listener may be spec'd, result of which is a detector that will still listen for master changes and record leaderhip changes internally but no listener would be notified. Detect may be called more than once, and each time the spec'd listener will be added to the list of those receiving notifications.
func (*MasterDetector) Done ¶
func (md *MasterDetector) Done() <-chan struct{}
returns a chan that, when closed, indicates termination of the detector
type MockConnector ¶
Impersontates a zk.Connection It implements interface Connector
func NewMockConnector ¶
func NewMockConnector() *MockConnector
func (*MockConnector) Close ¶
func (conn *MockConnector) Close()
type MockMasterDetector ¶
type MockMasterDetector struct { *MasterDetector // contains filtered or unexported fields }
func NewMockMasterDetector ¶
func NewMockMasterDetector(zkurls string) (*MockMasterDetector, error)
func (*MockMasterDetector) ScheduleConnEvent ¶
func (m *MockMasterDetector) ScheduleConnEvent(s zk.State)
func (*MockMasterDetector) ScheduleSessEvent ¶
func (m *MockMasterDetector) ScheduleSessEvent(t zk.EventType)
func (*MockMasterDetector) Start ¶
func (m *MockMasterDetector) Start()