Documentation ¶
Index ¶
- Constants
- type ErrorQueryService
- func (e *ErrorQueryService) Begin(ctx context.Context, target *querypb.Target) (int64, error)
- func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error
- func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, ...) (*sqltypes.Result, error)
- func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, ...) ([]sqltypes.Result, error)
- func (e *ErrorQueryService) HandlePanic(*error)
- func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error
- func (e *ErrorQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, ...) ([]querytypes.QuerySplit, error)
- func (e *ErrorQueryService) SplitQueryV2(ctx context.Context, target *querypb.Target, sql string, ...) ([]querytypes.QuerySplit, error)
- func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, ...) error
- func (e *ErrorQueryService) StreamHealthRegister(chan<- *querypb.StreamHealthResponse) (int, error)
- func (e *ErrorQueryService) StreamHealthUnregister(int) error
- type StreamHealthQueryService
- func (q *StreamHealthQueryService) AddDefaultHealthResponse()
- func (q *StreamHealthQueryService) AddHealthResponseWithQPS(qps float64)
- func (q *StreamHealthQueryService) StreamHealthRegister(c chan<- *querypb.StreamHealthResponse) (int, 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorQueryService ¶
type ErrorQueryService struct { }
ErrorQueryService is an implementation of QueryService that returns a configurable error for some of its methods.
It is used as base for other, more specialised QueryService fakes e.g. StreamHealthQueryService.
func (*ErrorQueryService) Commit ¶
func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error
Commit is part of QueryService interface
func (*ErrorQueryService) Execute ¶
func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error)
Execute is part of QueryService interface
func (*ErrorQueryService) ExecuteBatch ¶
func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
ExecuteBatch is part of QueryService interface
func (*ErrorQueryService) HandlePanic ¶
func (e *ErrorQueryService) HandlePanic(*error)
HandlePanic is part of QueryService interface
func (*ErrorQueryService) Rollback ¶
func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error
Rollback is part of QueryService interface
func (*ErrorQueryService) SplitQuery ¶
func (e *ErrorQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error)
SplitQuery is part of QueryService interface TODO(erez): Remove once the migration to SplitQuery V2 is done.
func (*ErrorQueryService) SplitQueryV2 ¶
func (e *ErrorQueryService) SplitQueryV2( ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm querypb.SplitQueryRequest_Algorithm, ) ([]querytypes.QuerySplit, error)
SplitQueryV2 is part of QueryService interface
func (*ErrorQueryService) StreamExecute ¶
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error
StreamExecute is part of QueryService interface
func (*ErrorQueryService) StreamHealthRegister ¶
func (e *ErrorQueryService) StreamHealthRegister(chan<- *querypb.StreamHealthResponse) (int, error)
StreamHealthRegister is part of QueryService interface
func (*ErrorQueryService) StreamHealthUnregister ¶
func (e *ErrorQueryService) StreamHealthUnregister(int) error
StreamHealthUnregister is part of QueryService interface
type StreamHealthQueryService ¶
type StreamHealthQueryService struct { ErrorQueryService // 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) 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) StreamHealthRegister ¶
func (q *StreamHealthQueryService) StreamHealthRegister(c chan<- *querypb.StreamHealthResponse) (int, error)
StreamHealthRegister 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.