go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/vttablet/queryservice/fakes Index | Files

package fakes

import "gopkg.in/src-d/go-vitess.v1/vt/vttablet/queryservice/fakes"

Index

Package Files

error_query_service.go stream_health_query_service.go

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) (bool, error)) error {
        return fmt.Errorf("ErrorQueryService does not implement any method")
    },
)

ErrorQueryService is an object that returns an error for all methods.

type StreamHealthQueryService Uses

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 Uses

func NewStreamHealthQueryService(target querypb.Target) *StreamHealthQueryService

NewStreamHealthQueryService creates a new fake query service for the target.

func (*StreamHealthQueryService) AddDefaultHealthResponse Uses

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 Uses

func (q *StreamHealthQueryService) AddHealthResponseWithNotServing()

AddHealthResponseWithNotServing adds a faked health response to the buffer channel. Only "Serving" is different in this message.

func (*StreamHealthQueryService) AddHealthResponseWithQPS Uses

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 Uses

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 Uses

func (q *StreamHealthQueryService) Begin(ctx context.Context, target *querypb.Target, options *querypb.ExecuteOptions) (int64, error)

Begin implemented as a no op

func (*StreamHealthQueryService) Execute Uses

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 Uses

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 Uses

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.

Package fakes imports 7 packages (graph) and is imported by 2 packages. Updated 2019-06-13. Refresh now. Tools for package owners.