pipeline

package
v1.5.51 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cast

func Cast[T any, U any](from Map[string, *Data[T]], to Map[string, *Data[U]]) (err error)

func SortData

func SortData[T any](data []*Data[T])

Types

type CollectiveProcess

type CollectiveProcess[I, O any] func(cxt context.Context, inputs []*Data[I]) (outputs []*Data[O], err error)

type CollectiveProcessor

type CollectiveProcessor[I, O any] interface {
	Processor
	Process(cxt context.Context, inputs []*Data[I]) (outputs []*Data[O], err error)
}

func CollectiveFunc

func CollectiveFunc[I, O any](name string, process CollectiveProcess[I, O]) CollectiveProcessor[I, O]

type Data

type Data[T any] struct {
	Path    string
	Content T
}

func DataMapToSlice

func DataMapToSlice[T any](data Map[string, *Data[T]]) (slice []*Data[T])

func NewData

func NewData[T any](path string, content T) *Data[T]

type ErrorGroup

type ErrorGroup []error

func (ErrorGroup) Error

func (eg ErrorGroup) Error() string

type FileSet

type FileSet Map[string, *Data[[]byte]]

type IndividualProcess

type IndividualProcess[I, O any] func(cxt context.Context, input *Data[I], index int32, total int32) (outputs []*Data[O], extra []*Data[I], err error)

type IndividualProcessor

type IndividualProcessor[I, O any] interface {
	Processor
	Process(cxt context.Context, input *Data[I], index int32, total int32) (outputs []*Data[O], extra []*Data[I], err error)
}

func ParallelFunc

func ParallelFunc[I, O any](name string, process IndividualProcess[I, O]) IndividualProcessor[I, O]

type Map

type Map[K comparable, V any] interface {
	Load(key K) (value V, ok bool)
	Store(key K, value V)
	LoadOrStore(key K, value V) (actual V, loaded bool)
	LoadAndStore(key K, value V) (actual V, loaded bool)
	Delete(key K)
	Size() int
	Range(f func(key K, value V) bool)
}

func Collective

func Collective[I, O any](cxt context.Context, options ProcessingOptions, processor CollectiveProcessor[I, O], input Map[string, *Data[I]]) (output Map[string, *Data[O]], err error)

func NewConcurrentMap

func NewConcurrentMap[K comparable, V any]() Map[K, V]

func NewConcurrentMapPresized

func NewConcurrentMapPresized[K comparable, V any](size int) Map[K, V]

func NewMap

func NewMap[K comparable, V any]() Map[K, V]

func NewMapPresized

func NewMapPresized[K comparable, V any](size int) Map[K, V]

func Parallel

func Parallel[I, O any](cxt context.Context, options ProcessingOptions, processor IndividualProcessor[I, O], input Map[string, *Data[I]]) (output Map[string, *Data[O]], err error)

type Once

type Once[T any] struct {
	// contains filtered or unexported fields
}

func (*Once[T]) Do

func (o *Once[T]) Do(f func() (T, error)) (T, error)

type Paths

type Paths Map[string, *Data[struct{}]]

func Start

func Start(cxt context.Context, targeter Targeter) (Paths, error)

type ProcessingOptions

type ProcessingOptions struct {
	Serial     bool `default:"false" help:"Process files one-by-one" group:"Processing:"`
	NoProgress bool `default:"false" name:"hide-progress-bar" help:"Hide the progress bar" group:"Processing:"`
}

type Processor

type Processor interface {
	Name() string
}

type StringSet

type StringSet Map[string, *Data[string]]

type Targeter

type Targeter func(cxt context.Context) ([]string, error)

Jump to

Keyboard shortcuts

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