source

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigKeyPollingPeriod is a config name for a polling period.
	ConfigKeyPollingPeriod = "pollingPeriod"
	// ConfigKeyBufferSize is a config name for a buffer size.
	ConfigKeyBufferSize = "bufferSize"
	// ConfigKeyExtraProperties is a config name for a extra properties.
	ConfigKeyExtraProperties = "extraProperties"
	// ConfigKeySnapshot is a config name for a snapshot field.
	ConfigKeySnapshot = "snapshot"
)

Variables

This section is empty.

Functions

func NewSource

func NewSource() sdk.Source

NewSource creates a new instance of the Source.

Types

type Config

type Config struct {
	config.Config

	// PollingPeriod is the duration that defines a period of polling
	// new items if CDC is not available for a resource.
	PollingPeriod time.Duration `key:"pollingPeriod" validate:"gte=0"`
	// BufferSize is the buffer size for consumed items.
	// It will also be used as a limit when retrieving items from the HubSpot API.
	BufferSize int `key:"bufferSize" validate:"gte=1,lte=100"`
	// ExtraProperties holds a list of HubSpot resource properties to include
	// in addition to the default. If any of the specified properties are not present
	// on the requested HubSpot resource, they will be ignored.
	// Only CRM resources support this.
	ExtraProperties []string `key:"extraProperties"`
	// Snapshot determines whether or not the connector will take a snapshot
	// of the entire collection before starting CDC mode.
	Snapshot bool `key:"snapshot"`
}

Config holds source-specific configurable values.

func ParseConfig

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

ParseConfig seeks to parse a provided map[string]string into a Config struct.

type Iterator

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

Iterator defines an Iterator interface needed for the Source.

type Source

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

Source is a HubSpot source plugin.

func (*Source) Ack

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

Ack does nothing. We don't need acks for the Snapshot or CDC iterators.

func (*Source) Configure

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

Configure parses and initializes the 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 fetches a new record from an iterator. If there's no record the method will return the sdk.ErrBackoffRetry.

func (*Source) Teardown

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

Teardown does nothing.

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