Documentation ¶
Overview ¶
Package tabletservermock provides mock interfaces for tabletserver.
Index ¶
- type BroadcastData
- type Controller
- func (tqsc *Controller) AddStatusHeader()
- func (tqsc *Controller) AddStatusPart()
- func (tqsc *Controller) BroadcastHealth()
- func (tqsc *Controller) CheckThrottler(ctx context.Context, appName string, flags *throttle.CheckFlags) *throttle.CheckResult
- func (tqsc *Controller) ClearQueryPlanCache()
- func (tqsc *Controller) ConcludeTransaction(context.Context, *querypb.Target, string) error
- func (tqsc *Controller) CurrentTarget() *querypb.Target
- func (tqsc *Controller) EnterLameduck()
- func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules
- func (tqsc *Controller) GetThrottlerStatus(ctx context.Context) *throttle.ThrottlerStatus
- func (tqsc *Controller) InitDBConfig(target *querypb.Target, dbcfgs *dbconfigs.DBConfigs, _ mysqlctl.MysqlDaemon) error
- func (tqsc *Controller) IsHealthy() error
- func (tqsc *Controller) IsServing() bool
- func (tqsc *Controller) QueryService() queryservice.QueryService
- func (tqsc *Controller) ReadTransaction(ctx context.Context, target *querypb.Target, dtid string) (*querypb.TransactionMetadata, error)
- func (tqsc *Controller) RedoPreparedTransactions()
- func (tqsc *Controller) Register()
- func (tqsc *Controller) RegisterQueryRuleSource(ruleSource string)
- func (tqsc *Controller) ReloadSchema(ctx context.Context) error
- func (tqsc *Controller) RollbackPrepared(context.Context, *querypb.Target, string, int64) error
- func (tqsc *Controller) SchemaEngine() *schema.Engine
- func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error
- func (tqsc *Controller) SetQueryServiceEnabledForTests(enabled bool)
- func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, ptsTime time.Time, serving bool, ...) error
- func (tqsc *Controller) SetTwoPCAllowed(int, bool)
- func (tqsc *Controller) Stats() *tabletenv.Stats
- func (tqsc *Controller) TopoServer() *topo.Server
- func (tqsc *Controller) UnRegisterQueryRuleSource(ruleSource string)
- func (tqsc *Controller) UnresolvedTransactions(context.Context, *querypb.Target, int64) ([]*querypb.TransactionMetadata, error)
- func (tqsc *Controller) WaitForPreparedTwoPCTransactions(context.Context) error
- type StateChange
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 { // 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 // SetServingTypeError is the return value for SetServingType. SetServingTypeError error // TS is the return value for TopoServer. TS *topo.Server MethodCalled map[string]bool // 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) AddStatusHeader ¶
func (tqsc *Controller) AddStatusHeader()
AddStatusHeader is part of the tabletserver.Controller interface
func (*Controller) AddStatusPart ¶
func (tqsc *Controller) AddStatusPart()
AddStatusPart is part of the tabletserver.Controller interface
func (*Controller) BroadcastHealth ¶
func (tqsc *Controller) BroadcastHealth()
BroadcastHealth is part of the tabletserver.Controller interface
func (*Controller) CheckThrottler ¶ added in v0.18.0
func (tqsc *Controller) CheckThrottler(ctx context.Context, appName string, flags *throttle.CheckFlags) *throttle.CheckResult
CheckThrottler is part of the tabletserver.Controller interface
func (*Controller) ClearQueryPlanCache ¶
func (tqsc *Controller) ClearQueryPlanCache()
ClearQueryPlanCache is part of the tabletserver.Controller interface
func (*Controller) ConcludeTransaction ¶ added in v0.21.0
ConcludeTransaction is part of the tabletserver.Controller interface
func (*Controller) CurrentTarget ¶
func (tqsc *Controller) CurrentTarget() *querypb.Target
CurrentTarget returns the current target.
func (*Controller) EnterLameduck ¶
func (tqsc *Controller) EnterLameduck()
EnterLameduck implements tabletserver.Controller.
func (*Controller) GetQueryRules ¶
func (tqsc *Controller) GetQueryRules(ruleSource string) *rules.Rules
GetQueryRules allows a test to check what was set.
func (*Controller) GetThrottlerStatus ¶ added in v0.21.0
func (tqsc *Controller) GetThrottlerStatus(ctx context.Context) *throttle.ThrottlerStatus
GetThrottlerStatus is part of the tabletserver.Controller interface
func (*Controller) InitDBConfig ¶
func (tqsc *Controller) InitDBConfig(target *querypb.Target, dbcfgs *dbconfigs.DBConfigs, _ 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) ReadTransaction ¶ added in v0.21.0
func (tqsc *Controller) ReadTransaction(ctx context.Context, target *querypb.Target, dtid string) (*querypb.TransactionMetadata, error)
ReadTransaction is part of the tabletserver.Controller interface
func (*Controller) RedoPreparedTransactions ¶ added in v0.21.0
func (tqsc *Controller) RedoPreparedTransactions()
RedoPreparedTransactions 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(ctx context.Context) error
ReloadSchema is part of the tabletserver.Controller interface
func (*Controller) RollbackPrepared ¶ added in v0.21.0
RollbackPrepared is part of the tabletserver.Controller interface
func (*Controller) SchemaEngine ¶
func (tqsc *Controller) SchemaEngine() *schema.Engine
SchemaEngine is part of the tabletserver.Controller interface
func (*Controller) SetQueryRules ¶
func (tqsc *Controller) SetQueryRules(ruleSource string, qrs *rules.Rules) error
SetQueryRules is part of the tabletserver.Controller interface
func (*Controller) SetQueryServiceEnabledForTests ¶
func (tqsc *Controller) SetQueryServiceEnabledForTests(enabled bool)
SetQueryServiceEnabledForTests can set queryServiceEnabled in tests.
func (*Controller) SetServingType ¶
func (tqsc *Controller) SetServingType(tabletType topodatapb.TabletType, ptsTime time.Time, serving bool, reason string) error
SetServingType is part of the tabletserver.Controller interface
func (*Controller) SetTwoPCAllowed ¶ added in v0.21.0
func (tqsc *Controller) SetTwoPCAllowed(int, bool)
SetTwoPCAllowed sets whether TwoPC is allowed or not. It also takes the reason of why it is being set. The reason should be an enum value defined in the tabletserver.
func (*Controller) Stats ¶
func (tqsc *Controller) Stats() *tabletenv.Stats
Stats is part of the tabletserver.Controller interface
func (*Controller) TopoServer ¶
func (tqsc *Controller) TopoServer() *topo.Server
TopoServer is part of the tabletserver.Controller interface.
func (*Controller) UnRegisterQueryRuleSource ¶
func (tqsc *Controller) UnRegisterQueryRuleSource(ruleSource string)
UnRegisterQueryRuleSource is part of the tabletserver.Controller interface
func (*Controller) UnresolvedTransactions ¶ added in v0.21.0
func (tqsc *Controller) UnresolvedTransactions(context.Context, *querypb.Target, int64) ([]*querypb.TransactionMetadata, error)
UnresolvedTransactions is part of the tabletserver.Controller interface
func (*Controller) WaitForPreparedTwoPCTransactions ¶ added in v0.21.0
func (tqsc *Controller) WaitForPreparedTwoPCTransactions(context.Context) error
WaitForPreparedTwoPCTransactions 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.