pipeline

package
v0.0.0-...-08353da Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentCall

type ConcurrentCall func(context.Context) (any, error)

type SequenceCall[T any] func(context.Context, chan T) chan T

type ConcurrentTask

type ConcurrentTask struct {
	Name string
	Call ConcurrentCall
}

type Pipeline

type Pipeline[T any] struct {
	StartCall       StartCall[T]
	SequenceTasks   []SequenceTask[T]
	ConcurrentTasks []ConcurrentTask
}

func NewPipeline

func NewPipeline[T any](
	sc StartCall[T], seqt []SequenceTask[T], conct []ConcurrentTask) *Pipeline[T]

func (*Pipeline[T]) Start

func (p *Pipeline[T]) Start(ctx context.Context) (<-chan Result, error)

type Result

type Result struct {
	Name  string
	Error error
	Value any
}

type SequenceHandler

type SequenceHandler[T any] interface {
	Start(context.Context) error
	Handle(context.Context, T) (T, error)
	Finish(context.Context) error
}

type SequenceTask

type SequenceTask[T any] struct {
	Name     string
	Capacity uint32
	Call     SequenceHandler[T]
}

type StartCall

type StartCall[T any] func(context.Context, chan<- T) error

Jump to

Keyboard shortcuts

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