binlogplayer

package
v0.0.0-...-4754828 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2014 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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, keyspaceIdType key.KeyspaceIdType, 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, connTimeout time.Duration) 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(params *mysql.ConnectionParams) *DBClient

func (*DBClient) Begin

func (dc *DBClient) Begin() error

func (*DBClient) Close

func (dc *DBClient) Close()

func (*DBClient) Commit

func (dc *DBClient) Commit() error

func (*DBClient) Connect

func (dc *DBClient) Connect() error

func (*DBClient) ExecuteFetch

func (dc *DBClient) ExecuteFetch(query string, maxrows int, wantfields bool) (*mproto.QueryResult, error)

func (*DBClient) Rollback

func (dc *DBClient) Rollback() error

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

type VtClient

type VtClient interface {
	Connect() error
	Begin() error
	Commit() error
	Rollback() error
	Close()
	ExecuteFetch(query string, maxrows int, wantfields bool) (qr *mproto.QueryResult, err error)
}

VtClient is a high level interface to the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL