forward

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Overview

Package forward does the Read (fromBuffer) -> Process (UDF) -> Forward (toBuffers) -> Ack (fromBuffer) loop.

Index

Constants

This section is empty.

Variables

View Source
var (
	All  = GoWhere(func(string) ([]string, error) { return []string{dfv1.MessageKeyAll}, nil })
	Drop = GoWhere(func(string) ([]string, error) { return []string{dfv1.MessageKeyDrop}, nil })
)

Functions

This section is empty.

Types

type GoWhere

type GoWhere func(string) ([]string, error)

GoWhere is the step decider on where it needs to go

func (GoWhere) WhereTo

func (gw GoWhere) WhereTo(b string) ([]string, error)

WhereTo decides where the data goes to.

type InterStepDataForward

type InterStepDataForward struct {
	FSD ToWhichStepDecider
	UDF udfapplier.Applier

	Shutdown
	// contains filtered or unexported fields
}

InterStepDataForward forwards the data from previous step to the current step via inter-step buffer.

func NewInterStepDataForward

func NewInterStepDataForward(vertex *dfv1.Vertex,
	fromStep isb.BufferReader,
	toSteps map[string]isb.BufferWriter,
	fsd ToWhichStepDecider,
	applyUDF udfapplier.Applier,
	fetchWatermark fetch.Fetcher,
	publishWatermark map[string]publish.Publisher,
	opts ...Option) (*InterStepDataForward, error)

NewInterStepDataForward creates an inter-step forwarder.

func (*InterStepDataForward) ForceStop

func (isdf *InterStepDataForward) ForceStop()

ForceStop sets up the force shutdown flag.

func (*InterStepDataForward) IsShuttingDown

func (isdf *InterStepDataForward) IsShuttingDown() (bool, error)

IsShuttingDown returns whether we can stop processing.

func (*InterStepDataForward) Start

func (isdf *InterStepDataForward) Start() <-chan struct{}

Start starts reading the buffer and forwards to the next buffers. Call `Stop` to stop.

func (*InterStepDataForward) Stop

func (isdf *InterStepDataForward) Stop()

Stop stops the processing.

type Option

type Option func(*options) error

func WithLogger

func WithLogger(l *zap.SugaredLogger) Option

WithLogger is used to return logger information

func WithReadBatchSize

func WithReadBatchSize(f int64) Option

WithReadBatchSize sets the read batch size

func WithRetryInterval

func WithRetryInterval(f time.Duration) Option

WithRetryInterval sets the retry interval

func WithUDFConcurrency

func WithUDFConcurrency(f int) Option

WithUDFConcurrency ste concurrency for UDF processing

func WithVertexType added in v0.6.1

func WithVertexType(t dfv1.VertexType) Option

WithVertexType sets the type of the vertex

type Shutdown

type Shutdown struct {
	// contains filtered or unexported fields
}

Shutdown tracks and enforces the shutdown activity.

func (*Shutdown) String

func (s *Shutdown) String() string

type StarterStopper

type StarterStopper interface {
	Start() <-chan struct{}
	Stop()
	ForceStop()
}

StarterStopper starts/stops the forwarding.

type ToWhichStepDecider

type ToWhichStepDecider interface {
	// WhereTo decides where to forward the result to based on the name of the step it returns.
	// It supports 2 addition keywords which need not be a step name. They are "ALL" and "DROP"
	// where former means, forward to all the neighbouring steps and latter means do not forward anywhere.
	WhereTo(string) ([]string, error)
}

ToWhichStepDecider decides which step to forward after applying the WhereTo function.

Jump to

Keyboard shortcuts

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