discovery

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

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

Go to latest
Published: Oct 3, 2015 License: BSD-3-Clause Imports: 13 Imported by: 0

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
	Cell                                string
	Target                              *pbq.Target
	TabletExternallyReparentedTimestamp int64
	Stats                               *pbq.RealtimeStats
}

EndPointStats is returned when getting the set of endpoints.

type EndPointsCacheStatus

type EndPointsCacheStatus struct {
	Cell           string
	Target         *pbq.Target
	EndPointsStats []*EndPointStats
}

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 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
	// 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 string, endPoint *pbt.EndPoint)

AddEndPoint adds the endpoint, and starts health check. It does not block.

func (*HealthCheckImpl) CacheStatus

func (hc *HealthCheckImpl) CacheStatus() EndPointsCacheStatusList

CacheStatus returns a displayable version of the cache.

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 string, target *pbq.Target, 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