Documentation ¶
Index ¶
- Constants
- type ErrorQueryService
- func (e *ErrorQueryService) Begin(ctx context.Context, target *querypb.Target) (int64, error)
- func (e *ErrorQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, ...) (*sqltypes.Result, int64, error)
- func (e *ErrorQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, ...) ([]sqltypes.Result, int64, error)
- func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error
- func (e *ErrorQueryService) CommitPrepared(ctx context.Context, target *querypb.Target, dtid string) (err error)
- func (e *ErrorQueryService) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, ...) (err 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) Prepare(ctx context.Context, target *querypb.Target, transactionID int64, dtid string) (err error)
- func (e *ErrorQueryService) ReadTransaction(ctx context.Context, target *querypb.Target, dtid string) (metadata *querypb.TransactionMetadata, err error)
- func (e *ErrorQueryService) ResolveTransaction(ctx context.Context, target *querypb.Target, dtid string) (err error)
- func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error
- func (e *ErrorQueryService) RollbackPrepared(ctx context.Context, target *querypb.Target, dtid string, originalID int64) (err error)
- func (e *ErrorQueryService) SetRollback(ctx context.Context, target *querypb.Target, dtid string, transactionID int64) (err error)
- func (e *ErrorQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, ...) ([]querytypes.QuerySplit, error)
- func (e *ErrorQueryService) StartCommit(ctx context.Context, target *querypb.Target, transactionID int64, dtid string) (err 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
- func (e *ErrorQueryService) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, ...) error
- 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) 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) BeginExecute ¶
func (e *ErrorQueryService) BeginExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions) (*sqltypes.Result, int64, error)
BeginExecute is part of QueryService interface
func (*ErrorQueryService) BeginExecuteBatch ¶
func (e *ErrorQueryService) BeginExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, options *querypb.ExecuteOptions) ([]sqltypes.Result, int64, error)
BeginExecuteBatch is part of QueryService interface
func (*ErrorQueryService) Commit ¶
func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error
Commit is part of QueryService interface
func (*ErrorQueryService) CommitPrepared ¶
func (e *ErrorQueryService) CommitPrepared(ctx context.Context, target *querypb.Target, dtid string) (err error)
CommitPrepared is part of QueryService interface
func (*ErrorQueryService) CreateTransaction ¶
func (e *ErrorQueryService) CreateTransaction(ctx context.Context, target *querypb.Target, dtid string, participants []*querypb.Target) (err error)
CreateTransaction 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, options *querypb.ExecuteOptions) (*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, options *querypb.ExecuteOptions) ([]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) Prepare ¶
func (e *ErrorQueryService) Prepare(ctx context.Context, target *querypb.Target, transactionID int64, dtid string) (err error)
Prepare is part of QueryService interface
func (*ErrorQueryService) ReadTransaction ¶
func (e *ErrorQueryService) ReadTransaction(ctx context.Context, target *querypb.Target, dtid string) (metadata *querypb.TransactionMetadata, err error)
ReadTransaction is part of QueryService interface
func (*ErrorQueryService) ResolveTransaction ¶
func (e *ErrorQueryService) ResolveTransaction(ctx context.Context, target *querypb.Target, dtid string) (err error)
ResolveTransaction 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) RollbackPrepared ¶
func (e *ErrorQueryService) RollbackPrepared(ctx context.Context, target *querypb.Target, dtid string, originalID int64) (err error)
RollbackPrepared is part of QueryService interface
func (*ErrorQueryService) SetRollback ¶
func (e *ErrorQueryService) SetRollback(ctx context.Context, target *querypb.Target, dtid string, transactionID int64) (err error)
SetRollback is part of QueryService interface
func (*ErrorQueryService) SplitQuery ¶
func (e *ErrorQueryService) SplitQuery( 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)
SplitQuery is part of QueryService interface
func (*ErrorQueryService) StartCommit ¶
func (e *ErrorQueryService) StartCommit(ctx context.Context, target *querypb.Target, transactionID int64, dtid string) (err error)
StartCommit is part of QueryService interface
func (*ErrorQueryService) StreamExecute ¶
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, options *querypb.ExecuteOptions, 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
func (*ErrorQueryService) UpdateStream ¶
func (e *ErrorQueryService) UpdateStream(ctx context.Context, target *querypb.Target, position string, timestamp int64, sendReply func(*querypb.StreamEvent) error) error
UpdateStream 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) 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) 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.