Documentation ¶
Index ¶
- Constants
- Variables
- type StreamHealthQueryService
- func (q *StreamHealthQueryService) AddDefaultHealthResponse()
- func (q *StreamHealthQueryService) AddHealthResponseWithNotServing()
- func (q *StreamHealthQueryService) AddHealthResponseWithQPS(qps float64)
- func (q *StreamHealthQueryService) AddHealthResponseWithSecondsBehindMaster(replicationLag uint32)
- func (q *StreamHealthQueryService) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error)
- func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, ...) (*sqltypes.Result, error)
- func (q *StreamHealthQueryService) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error
- func (q *StreamHealthQueryService) UpdateType(tabletType topodatapb.TabletType)
Constants ¶
const ( // DefaultSecondsBehindMaster is the default MySQL replication lag which is // reported in all faked stream health responses. DefaultSecondsBehindMaster uint32 = 1 )
Variables ¶
var ErrorQueryService = queryservice.Wrap( nil, func(ctx context.Context, target *querypb.Target, conn queryservice.QueryService, name string, inTransaction bool, inner func(context.Context, *querypb.Target, queryservice.QueryService) (error, bool)) error { return fmt.Errorf("ErrorQueryService does not implement any method") }, )
ErrorQueryService is an object that returns an error for all methods.
Functions ¶
This section is empty.
Types ¶
type StreamHealthQueryService ¶
type StreamHealthQueryService struct { queryservice.QueryService // contains filtered or unexported fields }
StreamHealthQueryService is a QueryService implementation which allows to send custom StreamHealthResponse messages by adding them to a channel. Note that it only works with one connected client because messages going into "healthResponses" are not duplicated to all clients.
If you want to override other QueryService methods, embed this struct as anonymous field in your own QueryService fake.
func NewStreamHealthQueryService ¶
func NewStreamHealthQueryService(target querypb.Target) *StreamHealthQueryService
NewStreamHealthQueryService creates a new fake query service for the target.
func (*StreamHealthQueryService) AddDefaultHealthResponse ¶
func (q *StreamHealthQueryService) AddDefaultHealthResponse()
AddDefaultHealthResponse adds a faked health response to the buffer channel. The response will have default values typical for a healthy tablet.
func (*StreamHealthQueryService) AddHealthResponseWithNotServing ¶
func (q *StreamHealthQueryService) AddHealthResponseWithNotServing()
AddHealthResponseWithNotServing adds a faked health response to the buffer channel. Only "Serving" is different in this message.
func (*StreamHealthQueryService) AddHealthResponseWithQPS ¶
func (q *StreamHealthQueryService) AddHealthResponseWithQPS(qps float64)
AddHealthResponseWithQPS adds a faked health response to the buffer channel. Only "qps" is different in this message.
func (*StreamHealthQueryService) AddHealthResponseWithSecondsBehindMaster ¶
func (q *StreamHealthQueryService) AddHealthResponseWithSecondsBehindMaster(replicationLag uint32)
AddHealthResponseWithSecondsBehindMaster adds a faked health response to the buffer channel. Only "seconds_behind_master" is different in this message.
func (*StreamHealthQueryService) Begin ¶
func (q *StreamHealthQueryService) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error)
Begin implemented as a no op
func (*StreamHealthQueryService) Execute ¶
func (q *StreamHealthQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]*querypb.BindVariable, transactionID int64, options *querypb.ExecuteOptions) (*sqltypes.Result, error)
Execute implemented as a no op
func (*StreamHealthQueryService) StreamHealth ¶
func (q *StreamHealthQueryService) StreamHealth(ctx context.Context, callback func(*querypb.StreamHealthResponse) error) error
StreamHealth implements the QueryService interface. It sends all queued and future healthResponses to the connected client e.g. the healthcheck module.
func (*StreamHealthQueryService) UpdateType ¶
func (q *StreamHealthQueryService) UpdateType(tabletType topodatapb.TabletType)
UpdateType changes the type of the query service. Only newly sent health messages will use the new type.