Documentation ¶
Overview ¶
Package source implements the source logic of the MongoDB connector.
Index ¶
- Constants
- func NewSource() sdk.Source
- type Config
- type Iterator
- type Source
- func (s *Source) Ack(ctx context.Context, position sdk.Position) error
- func (s *Source) Configure(_ context.Context, raw map[string]string) error
- func (s *Source) Open(ctx context.Context, sdkPosition sdk.Position) error
- func (s *Source) Parameters() map[string]sdk.Parameter
- func (s *Source) Read(ctx context.Context) (sdk.Record, error)
- func (s *Source) Teardown(ctx context.Context) error
Constants ¶
View Source
const ( // ConfigKeyBatchSize is a config name for a batch size. ConfigKeyBatchSize = "batchSize" // ConfigKeySnapshot is a config name for a snapshot field. ConfigKeySnapshot = "snapshot" // ConfigKeyOrderingField is a config name for a orderingField field. ConfigKeyOrderingField = "orderingField" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { config.Config // BatchSize is the size of a document batch. BatchSize int `key:"batchSize" validate:"gte=1,lte=100000"` // Snapshot determines whether or not the connector will take a snapshot // of the entire collection before starting CDC mode. Snapshot bool `key:"snapshot"` // OrderingField is the name of a field that is used for ordering // collection documents when capturing a snapshot. OrderingField string `key:"orderingField"` }
Config contains source-specific configurable values.
type Iterator ¶
type Iterator interface { HasNext(context.Context) (bool, error) Next(context.Context) (sdk.Record, error) Stop(context.Context) error }
Iterator defines an Iterator interface needed for the Source.
type Source ¶
type Source struct { sdk.UnimplementedSource // contains filtered or unexported fields }
Source implements the source logic of the MongoDB connector.
func (*Source) Configure ¶
Configure provides the connector with the configuration that is validated and stored. In case the configuration is not valid it returns an error.
func (*Source) Parameters ¶
Parameters is a map of named Parameters that describe how to configure the Source.
func (*Source) Read ¶
Read returns a new sdk.Record. It can return the error sdk.ErrBackoffRetry to signal to the SDK it should call Read again with a backoff retry.
Click to show internal directories.
Click to hide internal directories.