manager

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostPoolLabelValues

func GetHostPoolLabelValues(
	manager HostPoolManager,
	hostname string,
) (constraints.LabelValues, error)

GetHostPoolLabelValues creates a LabelValues for host pool of a host.

Types

type HostPoolManager

type HostPoolManager interface {
	// GetPool gets a host pool from cache by given pool id.
	GetPool(poolID string) (hostpool.HostPool, error)

	// Pools returns all host pools from cache.
	Pools() map[string]hostpool.HostPool

	// GetPoolByHostname returns the host pool given host belongs to.
	GetPoolByHostname(hostname string) (hostpool.HostPool, error)

	// RegisterPool creates a host pool with given ID if not exists.
	RegisterPool(poolID string)

	// DeregisterPool deletes existing host pool with given ID.
	DeregisterPool(poolID string) error

	// ChangeHostPool changes host pool of given host from source pool to
	// destination pool.
	ChangeHostPool(hostname, srcPool, destPool string) error

	// GetDesiredPool gets desired pool of given host in db.
	GetDesiredPool(hostname string) (string, error)

	// UpdateDesiredPool updates desired pool of given host in db.
	UpdateDesiredPool(hostname, poolID string) error

	// Start starts the host pool cache go routine that reconciles host pools.
	// It returns error if failed to recover host pool data from db.
	Start() error

	// Stop stops the host pool cache go routine that reconciles host pools.
	Stop()
}

HostPoolManager provides abstraction to manage host pools of a cluster.

func New

func New(
	reconcileInternal time.Duration,
	eventStreamHandler *eventstream.Handler,
	hostInfoOps objects.HostInfoOps,
	parentScope tally.Scope,
) HostPoolManager

New returns a host pool manager instance.

type Metrics

type Metrics struct {
	// Host pool cache snapshot metrics
	TotalHosts tally.Gauge
	TotalPools tally.Gauge

	// Host pool operating error metrics
	GetPoolErr           tally.Counter
	GetPoolByHostnameErr tally.Counter
	DeregisterPoolErr    tally.Counter
	ChangeHostPoolErr    tally.Counter
	ReconcileErr         tally.Counter
	UpdateCurrentPoolErr tally.Counter
	GetDesirePoolErr     tally.Counter
	UpdateDesiredPoolErr tally.Counter

	// Host pool manager performance metrics
	ReconcileTime tally.Timer
}

func NewMetrics

func NewMetrics(scope tally.Scope) *Metrics

Jump to

Keyboard shortcuts

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