source

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package source implements the source logic of the Neo4j connector.

Index

Constants

View Source
const (
	// ConfigKeyOrderingProperty is a config name for a orderingProperty field.
	ConfigKeyOrderingProperty = "orderingProperty"
	// ConfigKeyKeyProperties is a config name for a keyProperties field.
	ConfigKeyKeyProperties = "keyProperties"
	// ConfigKeyBatchSize is a config name for a batch size.
	ConfigKeyBatchSize = "batchSize"
	// ConfigKeySnapshot is a config name for a snapshot field.
	ConfigKeySnapshot = "snapshot"
)

Variables

This section is empty.

Functions

func New

func New() sdk.Source

New creates a new instance of the Source.

Types

type Config

type Config struct {
	config.Config

	// The name of a property that is used for ordering
	// nodes or relationships when capturing a snapshot.
	OrderingProperty string `json:"orderingProperty" validate:"required"`
	// The list of property names that are used for constructing a record key.
	KeyProperties []string `json:"keyProperties"`
	// The size of an element batch.
	BatchSize int `json:"batchSize" validate:"gt=0,lt=100001" default:"1000"`
	// Determines whether or not the connector will take a snapshot
	// of all nodes or relationships before starting polling mode.
	Snapshot bool `json:"snapshot" default:"true"`
}

Config holds configurable values specific to source.

func (Config) Parameters

func (Config) Parameters() map[string]sdk.Parameter

type Iterator

type Iterator interface {
	HasNext(context.Context) (bool, error)
	Next(context.Context) (sdk.Record, error)
}

Iterator defines an Iterator interface needed for the Source.

type Source

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

Source Neo4j Connector reads records from a Neo4j.

func (*Source) Ack

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

Ack just logs a provided position.

func (*Source) Configure

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

Configure parses and initializes the Source config.

func (*Source) Open

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

Open makes sure everything is prepared to read records.

func (*Source) Parameters

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

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

func (*Source) Read

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

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.

func (*Source) Teardown

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

Teardown closes connections, stops iterators and prepares for a graceful shutdown.

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