factory

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: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CategoryTxn is for Txn sink.
	CategoryTxn Category = 1
	// CategoryMQ is for MQ sink.
	CategoryMQ = 2
	// CategoryCloudStorage is for CloudStorage sink.
	CategoryCloudStorage = 3
	// CategoryBlackhole is for Blackhole sink.
	CategoryBlackhole = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category = int

Category is for different DML sink categories.

type SinkFactory

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

SinkFactory is the factory of sink. It is responsible for creating sink and closing it. Because there is no way to convert the eventsink.EventSink[*model.RowChangedEvent] to eventsink.EventSink[eventsink.TableEvent]. So we have to use this factory to create and store the sink.

func New

func New(
	ctx context.Context,
	changefeedID model.ChangeFeedID,
	sinkURIStr string,
	cfg *config.ReplicaConfig,
	errCh chan error,
	pdClock pdutil.Clock,
) (*SinkFactory, error)

New creates a new SinkFactory by scheme.

func (*SinkFactory) Category

func (s *SinkFactory) Category() Category

Category returns category of s.

func (*SinkFactory) Close

func (s *SinkFactory) Close()

Close closes the sink.

func (*SinkFactory) CreateTableSink

func (s *SinkFactory) CreateTableSink(
	changefeedID model.ChangeFeedID,
	span tablepb.Span,
	startTs model.Ts,
	PDClock pdutil.Clock,
	totalRowsCounter prometheus.Counter,
	flushLagDuration prometheus.Observer,
) tablesink.TableSink

CreateTableSink creates a TableSink by schema.

func (*SinkFactory) CreateTableSinkForConsumer

func (s *SinkFactory) CreateTableSinkForConsumer(
	changefeedID model.ChangeFeedID,
	span tablepb.Span, startTs model.Ts,
) tablesink.TableSink

CreateTableSinkForConsumer creates a TableSink by schema for consumer. The difference between CreateTableSink and CreateTableSinkForConsumer is that CreateTableSinkForConsumer will not create a new sink for each table. NOTICE: This only used for the consumer. Please do not use it in the processor.

Jump to

Keyboard shortcuts

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