tablesink

package
v0.0.0-...-592a62f Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventTableSink

type EventTableSink[E dmlsink.TableEvent, P dmlsink.Appender[E]] struct {
	// contains filtered or unexported fields
}

EventTableSink is a table sink that can write events.

func New

func New[E dmlsink.TableEvent, P dmlsink.Appender[E]](
	changefeedID model.ChangeFeedID,
	span tablepb.Span,
	startTs model.Ts,
	backendSink dmlsink.EventSink[E],
	appender P,
	pdClock pdutil.Clock,
	totalRowsCounter prometheus.Counter,
	flushLagDuration prometheus.Observer,
) *EventTableSink[E, P]

New an eventTableSink with given backendSink and event appender.

func (*EventTableSink[E, P]) AppendRowChangedEvents

func (e *EventTableSink[E, P]) AppendRowChangedEvents(rows ...*model.RowChangedEvent)

AppendRowChangedEvents appends row changed or txn events to the table sink.

func (*EventTableSink[E, P]) AsyncClose

func (e *EventTableSink[E, P]) AsyncClose() bool

AsyncClose closes the table sink asynchronously. Returns true if it's closed.

func (*EventTableSink[E, P]) CheckHealth

func (e *EventTableSink[E, P]) CheckHealth() error

CheckHealth checks whether the associated sink backend is healthy or not.

func (*EventTableSink[E, P]) Close

func (e *EventTableSink[E, P]) Close()

Close closes the table sink. After it returns, no more events will be sent out from this capture.

func (*EventTableSink[E, P]) GetCheckpointTs

func (e *EventTableSink[E, P]) GetCheckpointTs() model.ResolvedTs

GetCheckpointTs returns the checkpoint ts of the table sink.

func (*EventTableSink[E, P]) GetLastSyncedTs

func (e *EventTableSink[E, P]) GetLastSyncedTs() model.Ts

GetLastSyncedTs returns the last synced ts of table sink. lastSyncedTs means the biggest commits of all the events that have been flushed to the downstream.

func (*EventTableSink[E, P]) UpdateResolvedTs

func (e *EventTableSink[E, P]) UpdateResolvedTs(resolvedTs model.ResolvedTs) error

UpdateResolvedTs advances the resolved ts of the table sink.

type LastSyncedTsRecord

type LastSyncedTsRecord struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LastSyncedTsRecord is used to record the last synced ts of table sink with lock lastSyncedTs means the biggest commits of the events that have been flushed to the downstream.

type SinkInternalError

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

SinkInternalError means the error comes from sink internal.

func NewSinkInternalError

func NewSinkInternalError(err error) SinkInternalError

NewSinkInternalError creates a SinkInternalError.

func (SinkInternalError) Error

func (e SinkInternalError) Error() string

Error implements builtin `error` interface.

type TableSink

type TableSink interface {
	// AppendRowChangedEvents appends row changed events to the table sink.
	// Usually, it is used to cache the row changed events into table sink.
	// This is a not thread-safe method. Please do not call it concurrently.
	AppendRowChangedEvents(rows ...*model.RowChangedEvent)
	// UpdateResolvedTs writes the buffered row changed events to the eventTableSink.
	// Note: This is an asynchronous and not thread-safe method.
	// Please do not call it concurrently.
	UpdateResolvedTs(resolvedTs model.ResolvedTs) error
	// GetCheckpointTs returns the current checkpoint ts of table sink.
	// For example, calculating the current progress from the statistics of the table sink.
	// This is a thread-safe method.
	GetCheckpointTs() model.ResolvedTs
	// GetLastSyncedTs returns the last synced ts of table sink.
	// the last synced ts means the biggest commits of the events
	// that have been flushed to the downstream.
	// This is a thread-safe method.
	GetLastSyncedTs() model.Ts
	// Close closes the table sink.
	// After it returns, no more events will be sent out from this capture.
	Close()
	// AsyncClose closes the table sink asynchronously. Returns true if it's closed.
	AsyncClose() bool
	// CheckHealth checks whether the associated sink backend is healthy or not.
	CheckHealth() error
}

TableSink is the interface for table sink. It is used to sink data in table units.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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