source

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigKeyBufferSize = "bufferSize"

ConfigKeyBufferSize is a config name for a buffer size.

Variables

This section is empty.

Functions

func NewSource

func NewSource() sdk.Source

NewSource creates new instance of the Source.

Types

type Config

type Config struct {
	config.Config

	BufferSize int `key:"bufferSize" validate:"omitempty,min=64"`
}

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
	Next(ctx context.Context) (sdk.Record, error)
	Stop() error
}

Iterator defines an iterator interface.

type Source

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

Source operates source logic.

func (*Source) Configure

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

Configure parses and initializes the config.

func (*Source) Open

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

Open opens a connection to NATS and initializes iterators.

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 fetches a record from an iterator. If there's no record will return sdk.ErrBackoffRetry. If the Source's errC is not empty will return the underlying error.

func (*Source) Teardown

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

Teardown closes connections, stops iterator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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