tabletservermock

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package tabletservermock provides mock interfaces for tabletserver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastData

type BroadcastData struct {
	// TERTimestamp stores the last broadcast timestamp.
	TERTimestamp int64

	// RealtimeStats stores the last broadcast stats.
	RealtimeStats querypb.RealtimeStats

	// Serving contains the QueryServiceEnabled flag
	Serving bool
}

BroadcastData is used by the mock Controller to send data so the tests can check what was sent.

type Controller

type Controller struct {

	// CurrentTarget stores the last known target
	CurrentTarget querypb.Target

	// QueryServiceEnabled is a state variable
	QueryServiceEnabled bool

	// IsInLameduck is a state variable
	IsInLameduck bool

	// SetServingTypeError is the return value for SetServingType
	SetServingTypeError error

	// IsHealthy is the return value for IsHealthy
	IsHealthyError error

	// ReloadSchemaCount counts how many times ReloadSchema was called
	ReloadSchemaCount int

	// BroadcastData is a channel where we send BroadcastHealth data
	BroadcastData chan *BroadcastData

	// StateChanges has the list of state changes done by SetServingType().
	StateChanges chan *StateChange
	// contains filtered or unexported fields
}

Controller is a mock tabletserver.Controller

func NewController

func NewController() *Controller

NewController returns a mock of tabletserver.Controller

func (*Controller) AddStatusPart

func (tqsc *Controller) AddStatusPart()

AddStatusPart is part of the tabletserver.Controller interface

func (*Controller) BroadcastHealth

func (tqsc *Controller) BroadcastHealth(terTimestamp int64, stats *querypb.RealtimeStats)

BroadcastHealth is part of the tabletserver.Controller interface

func (*Controller) ClearQueryPlanCache

func (tqsc *Controller) ClearQueryPlanCache()

ClearQueryPlanCache is part of the tabletserver.Controller interface

func (*Controller) EnterLameduck

func (tqsc *Controller) EnterLameduck()

EnterLameduck implements tabletserver.Controller.

func (*Controller) InitDBConfig

func (tqsc *Controller) InitDBConfig(target querypb.Target, dbConfigs dbconfigs.DBConfigs, mysqld mysqlctl.MysqlDaemon) error

InitDBConfig is part of the tabletserver.Controller interface

func (*Controller) IsHealthy

func (tqsc *Controller) IsHealthy() error

IsHealthy is part of the tabletserver.Controller interface

func (*Controller) IsServing

func (tqsc *Controller) IsServing() bool

IsServing is part of the tabletserver.Controller interface

func (*Controller) QueryService

func (tqsc *Controller) QueryService() queryservice.QueryService

QueryService is part of the tabletserver.Controller interface

func (*Controller) QueryServiceStats

func (tqsc *Controller) QueryServiceStats() *tabletserver.QueryServiceStats

QueryServiceStats is part of the tabletserver.Controller interface

func (*Controller) Register

func (tqsc *Controller) Register()

Register is part of the tabletserver.Controller interface

func (*Controller) RegisterQueryRuleSource

func (tqsc *Controller) RegisterQueryRuleSource(ruleSource string)

RegisterQueryRuleSource is part of the tabletserver.Controller interface

func (*Controller) ReloadSchema

func (tqsc *Controller) ReloadSchema()

ReloadSchema is part of the tabletserver.Controller interface

func (*Controller) SetQueryRules

func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *tabletserver.QueryRules) error

SetQueryRules is part of the tabletserver.Controller interface

func (*Controller) SetServingType

func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, serving bool, alsoAllow []topodatapb.TabletType) (bool, error)

SetServingType is part of the tabletserver.Controller interface

func (*Controller) UnRegisterQueryRuleSource

func (tqsc *Controller) UnRegisterQueryRuleSource(ruleSource string)

UnRegisterQueryRuleSource is part of the tabletserver.Controller interface

type StateChange

type StateChange struct {
	// Serving is true when the QueryService is enabled.
	Serving bool
	// TabletType is the type of tablet e.g. REPLICA.
	TabletType topodatapb.TabletType
}

StateChange stores the state the controller changed to. Tests can use this to verify that the state changed as expected.

Jump to

Keyboard shortcuts

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