discovery

package
v2.0.0-alpha5+incompat... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2015 License: BSD-3-Clause Imports: 14 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndPointToMapKey

func EndPointToMapKey(endPoint *pbt.EndPoint) string

EndPointToMapKey creates a key to the map from endpoint's host and ports. It should only be used in discovery and related module.

Types

type CellTabletsWatcher

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

CellTabletsWatcher pulls endpoints of all running tablets periodically.

func NewCellTabletsWatcher

func NewCellTabletsWatcher(topoServer topo.Server, hc HealthCheck, cell string, refreshInterval time.Duration, topoReadConcurrency int) *CellTabletsWatcher

NewCellTabletsWatcher returns a CellTabletsWatcher and starts refreshing.

func (*CellTabletsWatcher) Stop

func (ctw *CellTabletsWatcher) Stop()

Stop stops the watcher. It does not clean up the endpoints added to HealthCheck.

type EndPointStats

type EndPointStats struct {
	EndPoint                            *pbt.EndPoint
	Name                                string // name is an optional tag (e.g. alternative address)
	Cell                                string
	Target                              *pbq.Target
	Serving                             bool
	TabletExternallyReparentedTimestamp int64
	Stats                               *pbq.RealtimeStats
	LastError                           error
}

EndPointStats is returned when getting the set of endpoints.

type EndPointStatsList

type EndPointStatsList []*EndPointStats

EndPointStatsList is used for sorting.

func (EndPointStatsList) Len

func (epsl EndPointStatsList) Len() int

Len is part of sort.Interface.

func (EndPointStatsList) Less

func (epsl EndPointStatsList) Less(i, j int) bool

Less is part of sort.Interface

func (EndPointStatsList) Swap

func (epsl EndPointStatsList) Swap(i, j int)

Swap is part of sort.Interface

type EndPointsCacheStatus

type EndPointsCacheStatus struct {
	Cell           string
	Target         *pbq.Target
	EndPointsStats EndPointStatsList
}

EndPointsCacheStatus is the current endpoints for a cell/target. TODO: change this to reflect the e2e information about the endpoints.

func (*EndPointsCacheStatus) StatusAsHTML

func (epcs *EndPointsCacheStatus) StatusAsHTML() template.HTML

StatusAsHTML returns an HTML version of the status.

type EndPointsCacheStatusList

type EndPointsCacheStatusList []*EndPointsCacheStatus

EndPointsCacheStatusList is used for sorting.

func (EndPointsCacheStatusList) Len

func (epcsl EndPointsCacheStatusList) Len() int

Len is part of sort.Interface.

func (EndPointsCacheStatusList) Less

func (epcsl EndPointsCacheStatusList) Less(i, j int) bool

Less is part of sort.Interface

func (EndPointsCacheStatusList) Swap

func (epcsl EndPointsCacheStatusList) Swap(i, j int)

Swap is part of sort.Interface

type HealthCheck

type HealthCheck interface {
	// SetListener sets the listener for healthcheck updates. It should not block.
	SetListener(listener HealthCheckStatsListener)
	// AddEndPoint adds the endpoint, and starts health check.
	AddEndPoint(cell, name string, endPoint *pbt.EndPoint)
	// RemoveEndPoint removes the endpoint, and stops the health check.
	RemoveEndPoint(endPoint *pbt.EndPoint)
	// GetEndPointStatsFromKeyspaceShard returns all EndPointStats for the given keyspace/shard.
	GetEndPointStatsFromKeyspaceShard(keyspace, shard string) []*EndPointStats
	// GetEndPointStatsFromTarget returns all EndPointStats for the given target.
	GetEndPointStatsFromTarget(keyspace, shard string, tabletType pbt.TabletType) []*EndPointStats
	// GetConnection returns the TabletConn of the given endpoint.
	GetConnection(endPoint *pbt.EndPoint) tabletconn.TabletConn
	// CacheStatus returns a displayable version of the cache.
	CacheStatus() EndPointsCacheStatusList
}

HealthCheck defines the interface of health checking module.

func NewHealthCheck

func NewHealthCheck(connTimeout time.Duration, retryDelay time.Duration) HealthCheck

NewHealthCheck creates a new HealthCheck object.

type HealthCheckImpl

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

HealthCheckImpl performs health checking and notifies downstream components about any changes.

func (*HealthCheckImpl) AddEndPoint

func (hc *HealthCheckImpl) AddEndPoint(cell, name string, endPoint *pbt.EndPoint)

AddEndPoint adds the endpoint, and starts health check. It does not block on making connection. name is an optional tag for the endpoint, e.g. an alternative address.

func (*HealthCheckImpl) CacheStatus

func (hc *HealthCheckImpl) CacheStatus() EndPointsCacheStatusList

CacheStatus returns a displayable version of the cache.

func (*HealthCheckImpl) GetConnection

func (hc *HealthCheckImpl) GetConnection(endPoint *pbt.EndPoint) tabletconn.TabletConn

GetConnection returns the TabletConn of the given endpoint.

func (*HealthCheckImpl) GetEndPointStatsFromKeyspaceShard

func (hc *HealthCheckImpl) GetEndPointStatsFromKeyspaceShard(keyspace, shard string) []*EndPointStats

GetEndPointStatsFromKeyspaceShard returns all EndPointStats for the given keyspace/shard.

func (*HealthCheckImpl) GetEndPointStatsFromTarget

func (hc *HealthCheckImpl) GetEndPointStatsFromTarget(keyspace, shard string, tabletType pbt.TabletType) []*EndPointStats

GetEndPointStatsFromTarget returns all EndPointStats for the given target.

func (*HealthCheckImpl) RemoveEndPoint

func (hc *HealthCheckImpl) RemoveEndPoint(endPoint *pbt.EndPoint)

RemoveEndPoint removes the endpoint, and stops the health check. It does not block.

func (*HealthCheckImpl) SetListener

func (hc *HealthCheckImpl) SetListener(listener HealthCheckStatsListener)

SetListener sets the listener for healthcheck updates. It should not block.

type HealthCheckStatsListener

type HealthCheckStatsListener interface {
	StatsUpdate(endPoint *pbt.EndPoint, cell, name string, target *pbq.Target, serving bool, tabletExternallyReparentedTimestamp int64, stats *pbq.RealtimeStats)
}

HealthCheckStatsListener is the listener to receive health check stats update.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL