Documentation ¶
Index ¶
- Variables
- func NewBlplStats() *blplStats
- func ReadStartPosition(dbClient VtClient, uid uint32) (*myproto.BlpPosition, error)
- func RegisterBinlogPlayerClientFactory(name string, factory BinlogPlayerClientFactory)
- type BinlogPlayer
- type BinlogPlayerClient
- type BinlogPlayerClientFactory
- type BinlogPlayerResponse
- type DBClient
- type DummyVtClient
- func (dc DummyVtClient) Begin() error
- func (dc DummyVtClient) Close()
- func (dc DummyVtClient) Commit() error
- func (dc DummyVtClient) Connect() error
- func (dc DummyVtClient) ExecuteFetch(query string, maxrows int, wantfields bool) (qr *mproto.QueryResult, err error)
- func (dc DummyVtClient) Rollback() error
- type VtClient
Constants ¶
This section is empty.
Variables ¶
var ( SLOW_QUERY_THRESHOLD = time.Duration(100 * time.Millisecond) BLPL_STREAM_COMMENT_START = []byte("/* _stream ") BLPL_SPACE = []byte(" ") )
Functions ¶
func NewBlplStats ¶
func NewBlplStats() *blplStats
func ReadStartPosition ¶
func ReadStartPosition(dbClient VtClient, uid uint32) (*myproto.BlpPosition, error)
func RegisterBinlogPlayerClientFactory ¶
func RegisterBinlogPlayerClientFactory(name string, factory BinlogPlayerClientFactory)
Types ¶
type BinlogPlayer ¶
type BinlogPlayer struct {
// contains filtered or unexported fields
}
BinlogPlayer is handling reading a stream of updates from BinlogServer
func NewBinlogPlayerKeyRange ¶
func NewBinlogPlayerKeyRange(dbClient VtClient, addr string, keyRange key.KeyRange, startPosition *myproto.BlpPosition, stopAtGroupId int64) *BinlogPlayer
NewBinlogPlayerKeyRange returns a new BinlogPlayer pointing at the server replicating the provided keyrange, starting at the startPosition.GroupId, and updating _vt.blp_checkpoint with uid=startPosition.Uid. If stopAtGroupId != 0, it will stop when reaching that GroupId.
func NewBinlogPlayerTables ¶
func NewBinlogPlayerTables(dbClient VtClient, addr string, tables []string, startPosition *myproto.BlpPosition, stopAtGroupId int64) *BinlogPlayer
NewBinlogPlayerTables returns a new BinlogPlayer pointing at the server replicating the provided tables, starting at the startPosition.GroupId, and updating _vt.blp_checkpoint with uid=startPosition.Uid. If stopAtGroupId != 0, it will stop when reaching that GroupId.
func (*BinlogPlayer) ApplyBinlogEvents ¶
func (blp *BinlogPlayer) ApplyBinlogEvents(interrupted chan struct{}) error
ApplyBinlogEvents makes a gob rpc request to BinlogServer and processes the events. It will return nil if 'interrupted' was closed, or if we reached the stopping point. It will return io.EOF if the server stops sending us updates. It may return any other error it encounters.
func (*BinlogPlayer) StatsJSON ¶
func (blp *BinlogPlayer) StatsJSON() string
type BinlogPlayerClient ¶
type BinlogPlayerClient interface { // Dial a server Dial(addr string) error // Close the connection Close() // Ask the server to stream binlog updates ServeUpdateStream(*proto.UpdateStreamRequest, chan *proto.StreamEvent) BinlogPlayerResponse // Ask the server to stream updates related to the provided tables StreamTables(*proto.TablesRequest, chan *proto.BinlogTransaction) BinlogPlayerResponse // Ask the server to stream updates related to thee provided keyrange StreamKeyRange(*proto.KeyRangeRequest, chan *proto.BinlogTransaction) BinlogPlayerResponse }
BinlogPlayerClient is the interface all clients must satisfy
type BinlogPlayerClientFactory ¶
type BinlogPlayerClientFactory func() BinlogPlayerClient
type BinlogPlayerResponse ¶
type BinlogPlayerResponse interface {
Error() error
}
BinlogPlayerResponse is the return value for streaming events
type DBClient ¶
type DBClient struct {
// contains filtered or unexported fields
}
DBClient is a real VtClient backed by a mysql connection
func NewDbClient ¶
func NewDbClient(dbConfig *mysql.ConnectionParams) *DBClient
func (*DBClient) ExecuteFetch ¶
type DummyVtClient ¶
type DummyVtClient struct {
// contains filtered or unexported fields
}
DummyVtClient is a VtClient that writes to a writer instead of executing anything
func NewDummyVtClient ¶
func NewDummyVtClient() *DummyVtClient
func (DummyVtClient) Begin ¶
func (dc DummyVtClient) Begin() error
func (DummyVtClient) Close ¶
func (dc DummyVtClient) Close()
func (DummyVtClient) Commit ¶
func (dc DummyVtClient) Commit() error
func (DummyVtClient) Connect ¶
func (dc DummyVtClient) Connect() error
func (DummyVtClient) ExecuteFetch ¶
func (dc DummyVtClient) ExecuteFetch(query string, maxrows int, wantfields bool) (qr *mproto.QueryResult, err error)
func (DummyVtClient) Rollback ¶
func (dc DummyVtClient) Rollback() error