reader

package
v0.0.0-...-4624acb Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackHoleReader

type BlackHoleReader struct{}

BlackHoleReader is a blockHole storage which implements LogReader interface

func (*BlackHoleReader) Close

func (br *BlackHoleReader) Close() error

Close implement the Close interface

func (*BlackHoleReader) ReadMeta

func (br *BlackHoleReader) ReadMeta(ctx context.Context) (checkpointTs, resolvedTs uint64, err error)

ReadMeta implements LogReader.ReadMeta

func (*BlackHoleReader) ReadNextDDL

func (br *BlackHoleReader) ReadNextDDL(ctx context.Context) (*model.DDLEvent, error)

ReadNextDDL implements LogReader.ReadNextDDL

func (*BlackHoleReader) ReadNextRow

func (br *BlackHoleReader) ReadNextRow(ctx context.Context) (*model.RowChangedEvent, error)

ReadNextRow implements LogReader.ReadNextRow

func (*BlackHoleReader) Run

func (br *BlackHoleReader) Run(ctx context.Context) error

Run implements LogReader.Run

type LogReader

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

LogReader implement RedoLogReader interface

func (*LogReader) ReadMeta

func (l *LogReader) ReadMeta(ctx context.Context) (checkpointTs, resolvedTs uint64, err error)

ReadMeta implement ReadMeta interface

func (*LogReader) ReadNextDDL

func (l *LogReader) ReadNextDDL(ctx context.Context) (*model.DDLEvent, error)

ReadNextDDL implement the `RedoLogReader` interface.

func (*LogReader) ReadNextRow

func (l *LogReader) ReadNextRow(ctx context.Context) (*model.RowChangedEvent, error)

ReadNextRow implement the `RedoLogReader` interface.

func (*LogReader) Run

func (l *LogReader) Run(ctx context.Context) error

Run implements the `RedoLogReader` interface.

type LogReaderConfig

type LogReaderConfig struct {
	// Dir is the folder contains the redo logs need to apply when OP environment or
	// the folder used to download redo logs to if using external storage, such as s3
	// and gcs.
	Dir string

	// URI should be like "s3://logbucket/test-changefeed?endpoint=http://$S3_ENDPOINT/"
	URI                url.URL
	UseExternalStorage bool

	// WorkerNums is the num of workers used to sort the log file to sorted file,
	// will load the file to memory first then write the sorted file to disk
	// the memory used is WorkerNums * defaultMaxLogSize (64 * megabyte) total
	WorkerNums int
}

LogReaderConfig is the config for LogReader

type RedoLogReader

type RedoLogReader interface {
	// Run read and decode redo logs in background.
	Run(ctx context.Context) error
	// ReadNextRow read one row event from redo logs.
	ReadNextRow(ctx context.Context) (*model.RowChangedEvent, error)
	// ReadNextDDL read one ddl event from redo logs.
	ReadNextDDL(ctx context.Context) (*model.DDLEvent, error)
	// ReadMeta reads meta from redo logs and returns the latest checkpointTs and resolvedTs
	ReadMeta(ctx context.Context) (checkpointTs, resolvedTs uint64, err error)
}

RedoLogReader is a reader abstraction for redo log storage layer

func NewRedoLogReader

func NewRedoLogReader(
	ctx context.Context, storageType string, cfg *LogReaderConfig,
) (rd RedoLogReader, err error)

NewRedoLogReader creates a new redo log reader

Jump to

Keyboard shortcuts

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