source

package
v0.0.0-...-759a12d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyOrderingColumn is a config name for an ordering column.
	KeyOrderingColumn = "orderingColumn"
	// KeyColumns is a config name for columns.
	KeyColumns = "columns"
	// KeyBatchSize is a config name for a batch size.
	KeyBatchSize = "batchSize"
	// KeyPrimaryKeys is a config name for primary keys.
	KeyPrimaryKeys = "primaryKeys"
	// KeySnapshot is a config name for snapshotMode.
	KeySnapshot = "snapshot"
)

Variables

This section is empty.

Functions

func New

func New() sdk.Source

New initialises a new source.

Types

type Config

type Config struct {
	config.Config

	// OrderingColumn is a name of a column that the connector will use for ordering rows.
	OrderingColumn string `key:"orderingColumn" validate:"required,max=128"`
	// Columns  list of column names that should be included in each Record's payload.
	Columns []string `key:"columns" validate:"contains_or_default=OrderingColumn,dive,max=128"`
	// BatchSize is a size of rows batch.
	BatchSize int `key:"batchSize" validate:"gte=1,lte=100000"`
	// PrimaryKeys list of column names should use for their `Key` fields.
	PrimaryKeys []string `validate:"dive,max=128"`
	// Snapshot whether or not the plugin will take a snapshot of the entire table before starting cdc.
	Snapshot bool
}

Config holds source specific configurable values.

func Parse

func Parse(cfg map[string]string) (Config, error)

Parse maps the incoming map to the Config and validates it.

type Iterator

type Iterator interface {
	HasNext(ctx context.Context) (bool, error)
	Next(ctx context.Context) (sdk.Record, error)
	Stop() error
	Ack(ctx context.Context, rp sdk.Position) error
}

Iterator interface.

type Source

type Source struct {
	sdk.UnimplementedSource
	// contains filtered or unexported fields
}

Source connector.

func (*Source) Ack

func (s *Source) Ack(ctx context.Context, p sdk.Position) error

Ack check if record with position was recorded.

func (*Source) Configure

func (s *Source) Configure(_ context.Context, cfgRaw map[string]string) error

Configure parses and stores configurations, returns an error in case of invalid configuration.

func (*Source) Open

func (s *Source) Open(ctx context.Context, rp sdk.Position) error

Open prepare the plugin to start sending records from the given position.

func (*Source) Parameters

func (s *Source) Parameters() map[string]sdk.Parameter

Parameters returns a map of named sdk.Parameters that describe how to configure the Source.

func (*Source) Read

func (s *Source) Read(ctx context.Context) (sdk.Record, error)

Read gets the next object from the db2.

func (*Source) Teardown

func (s *Source) Teardown(context.Context) error

Teardown gracefully shutdown connector.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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