go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletservermock Index | Files

package tabletservermock

import "gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletservermock"

Package tabletservermock provides mock interfaces for tabletserver.

Index

Package Files

controller.go

type BroadcastData Uses

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 Uses

type Controller struct {
    // BroadcastData is a channel where we send BroadcastHealth data.
    // Set at construction time.
    BroadcastData chan *BroadcastData

    // StateChanges has the list of state changes done by SetServingType().
    // Set at construction time.
    StateChanges chan *StateChange

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

    // SetServingTypeError is the return value for SetServingType.
    SetServingTypeError error

    // TS is the return value for TopoServer.
    TS  *topo.Server
    // contains filtered or unexported fields
}

Controller is a mock tabletserver.Controller

func NewController Uses

func NewController() *Controller

NewController returns a mock of tabletserver.Controller

func (*Controller) AddStatusPart Uses

func (tqsc *Controller) AddStatusPart()

AddStatusPart is part of the tabletserver.Controller interface

func (*Controller) BroadcastHealth Uses

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

BroadcastHealth is part of the tabletserver.Controller interface

func (*Controller) ClearQueryPlanCache Uses

func (tqsc *Controller) ClearQueryPlanCache()

ClearQueryPlanCache is part of the tabletserver.Controller interface

func (*Controller) EnterLameduck Uses

func (tqsc *Controller) EnterLameduck()

EnterLameduck implements tabletserver.Controller.

func (*Controller) GetQueryRules Uses

func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules

GetQueryRules allows a test to check what was set.

func (*Controller) HeartbeatLag Uses

func (tqsc *Controller) HeartbeatLag() (time.Duration, error)

HeartbeatLag is part of the tabletserver.Controller interface.

func (*Controller) InitDBConfig Uses

func (tqsc *Controller) InitDBConfig(target querypb.Target, dbcfgs *dbconfigs.DBConfigs) error

InitDBConfig is part of the tabletserver.Controller interface

func (*Controller) IsHealthy Uses

func (tqsc *Controller) IsHealthy() error

IsHealthy is part of the tabletserver.Controller interface

func (*Controller) IsServing Uses

func (tqsc *Controller) IsServing() bool

IsServing is part of the tabletserver.Controller interface

func (*Controller) QueryService Uses

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

QueryService is part of the tabletserver.Controller interface

func (*Controller) Register Uses

func (tqsc *Controller) Register()

Register is part of the tabletserver.Controller interface

func (*Controller) RegisterQueryRuleSource Uses

func (tqsc *Controller) RegisterQueryRuleSource(ruleSource string)

RegisterQueryRuleSource is part of the tabletserver.Controller interface

func (*Controller) ReloadSchema Uses

func (tqsc *Controller) ReloadSchema(ctx context.Context) error

ReloadSchema is part of the tabletserver.Controller interface

func (*Controller) SchemaEngine Uses

func (tqsc *Controller) SchemaEngine() *schema.Engine

SchemaEngine is part of the tabletserver.Controller interface

func (*Controller) SetQueryRules Uses

func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error

SetQueryRules is part of the tabletserver.Controller interface

func (*Controller) SetQueryServiceEnabledForTests Uses

func (tqsc *Controller) SetQueryServiceEnabledForTests(enabled bool)

SetQueryServiceEnabledForTests can set queryServiceEnabled in tests.

func (*Controller) SetServingType Uses

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

SetServingType is part of the tabletserver.Controller interface

func (*Controller) TopoServer Uses

func (tqsc *Controller) TopoServer() *topo.Server

TopoServer is part of the tabletserver.Controller interface.

func (*Controller) UnRegisterQueryRuleSource Uses

func (tqsc *Controller) UnRegisterQueryRuleSource(ruleSource string)

UnRegisterQueryRuleSource is part of the tabletserver.Controller interface

type StateChange Uses

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.

Package tabletservermock imports 10 packages (graph) and is imported by 1 packages. Updated 2019-06-13. Refresh now. Tools for package owners.