reader

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SyncConfig replication.BinlogSyncerConfig
	Pos        mysql.Position
	GTIDs      gtid.Set
	EnableGTID bool
	MasterID   string // the identifier for the master, used when logging.
}

Config is the configuration used by the Reader.

type Reader

type Reader interface {
	// Start starts the reading process.
	Start() error

	// Close closes the reader and release the resource.
	Close() error

	// GetEvent gets the binlog event one by one, it will block if no event can be read.
	// You can pass a context (like Cancel) to break the block.
	GetEvent(ctx context.Context) (Result, error)
}

Reader reads binlog events from a upstream master server. The read binlog events should be send to a transformer. The reader should support:

  1. handle expected errors
  2. do retry if possible

NOTE: some errors still need to be handled in the outer caller.

func NewReader

func NewReader(cfg *Config) Reader

NewReader creates a Reader instance.

type Result

type Result struct {
	Event *replication.BinlogEvent
}

Result represents a read operation result.

Jump to

Keyboard shortcuts

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