Documentation ¶
Index ¶
- Constants
- Variables
- type StreamHealthQueryService
- func (q *StreamHealthQueryService) AddDefaultHealthResponse()
- func (q *StreamHealthQueryService) AddHealthResponseWithNotServing()
- func (q *StreamHealthQueryService) AddHealthResponseWithQPS(qps float64)
- func (q *StreamHealthQueryService) AddHealthResponseWithReplicationLag(replicationLag uint32)
- func (q *StreamHealthQueryService) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (queryservice.TransactionState, 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 ( // DefaultReplicationLagSeconds is the default MySQL replication lag which is // reported in all faked stream health responses. DefaultReplicationLagSeconds 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) (bool, error)) 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) AddHealthResponseWithReplicationLag ¶ added in v0.12.0
func (q *StreamHealthQueryService) AddHealthResponseWithReplicationLag(replicationLag uint32)
AddHealthResponseWithReplicationLag adds a faked health response to the buffer channel. Only "replication_lag_seconds" is different in this message.
func (*StreamHealthQueryService) Begin ¶
func (q *StreamHealthQueryService) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (queryservice.TransactionState, 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, reservedID 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.