streamer

package
v1.0.4-hotfix Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectAllBinlogFiles

func CollectAllBinlogFiles(dir string) ([]string, error)

CollectAllBinlogFiles collects all valid binlog files in dir

func CollectBinlogFilesCmp

func CollectBinlogFilesCmp(dir, baseFile string, cmp FileCmp) ([]string, error)

CollectBinlogFilesCmp collects valid binlog files with a compare condition

Types

type BinlogReader

type BinlogReader struct {
	// contains filtered or unexported fields
}

BinlogReader is a binlog reader.

func NewBinlogReader

func NewBinlogReader(tctx *tcontext.Context, cfg *BinlogReaderConfig) *BinlogReader

NewBinlogReader creates a new BinlogReader

func (*BinlogReader) Close

func (r *BinlogReader) Close()

Close closes BinlogReader.

func (*BinlogReader) StartSync

func (r *BinlogReader) StartSync(pos mysql.Position) (Streamer, error)

StartSync start syncon TODO: thread-safe?

type BinlogReaderConfig

type BinlogReaderConfig struct {
	RelayDir string
	Timezone *time.Location
}

BinlogReaderConfig is the configuration for BinlogReader

type FileCmp

type FileCmp uint8

FileCmp is a compare condition used when collecting binlog files

const (
	FileCmpLess FileCmp = iota + 1
	FileCmpLessEqual
	FileCmpEqual
	FileCmpBiggerEqual
	FileCmpBigger
)

FileCmpLess represents a < FileCmp condition, others are similar

type LocalStreamer

type LocalStreamer struct {
	// contains filtered or unexported fields
}

LocalStreamer reads and parses binlog events from local binlog file.

func (*LocalStreamer) GetEvent

GetEvent gets the binlog event one by one, it will block until parser occurs some errors. You can pass a context (like Cancel or Timeout) to break the block.

type ReaderHub

type ReaderHub struct {
	// contains filtered or unexported fields
}

ReaderHub holds information for all active Readers

func GetReaderHub

func GetReaderHub() *ReaderHub

GetReaderHub gets singleton instance of ReaderHub

func (*ReaderHub) EarliestActiveRelayLog

func (h *ReaderHub) EarliestActiveRelayLog() *RelayLogInfo

EarliestActiveRelayLog implements RelayOperator.EarliestActiveRelayLog

func (*ReaderHub) RemoveActiveRelayLog

func (h *ReaderHub) RemoveActiveRelayLog(taskName string)

RemoveActiveRelayLog removes active relay log for taskName

func (*ReaderHub) UpdateActiveRelayLog

func (h *ReaderHub) UpdateActiveRelayLog(taskName, uuid, filename string) error

UpdateActiveRelayLog updates active relay log for taskName

type RelayLogInfo

type RelayLogInfo struct {
	TaskName   string
	UUID       string
	UUIDSuffix int
	Filename   string
}

RelayLogInfo represents information for relay log

func (*RelayLogInfo) Earlier

func (info *RelayLogInfo) Earlier(other *RelayLogInfo) bool

Earlier checks whether this relay log file is earlier than the other

func (*RelayLogInfo) String

func (info *RelayLogInfo) String() string

String implements Stringer.String

type Streamer

type Streamer interface {
	// GetEvent returns binlog event
	GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
}

Streamer provides the ability to get binlog event from remote server or local file.

Jump to

Keyboard shortcuts

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