transformer

package
v1.2.3-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDGenerator

func IDGenerator(_ context.Context, job *models.Job) error

IDGenerator is a transformer that generates a new ID for the job if it is empty.

Types

type ChainedTransformer added in v1.1.4

type ChainedTransformer[T any] []GenericTransformer[T]

ChainedTransformer is a slice of Transformers that runs in sequence

func (ChainedTransformer[T]) Transform added in v1.1.4

func (ct ChainedTransformer[T]) Transform(ctx context.Context, obj T) error

Transform runs all transformers in sequence.

type GenericTransformer added in v1.1.4

type GenericTransformer[T any] interface {
	Transform(context.Context, T) error
}

GenericTransformer is an interface that can be used to modify an object in place.

type JobDefaults added in v1.1.0

type JobDefaults struct {
	ExecutionTimeout time.Duration
}

type JobFn

type JobFn func(context.Context, *models.Job) error

JobFn is a function that implements JobTransformer transform interface.

func (JobFn) Transform

func (fn JobFn) Transform(ctx context.Context, job *models.Job) error

type JobTransformer added in v1.1.1

type JobTransformer interface {
	GenericTransformer[*models.Job]
}

JobTransformer is an interface that can be used to modify a job in place, such as setting default values or migrating.

func DefaultPublisher added in v1.2.2

func DefaultPublisher(publisherConfig *models.SpecConfig) JobTransformer

func DefaultsApplier added in v1.1.0

func DefaultsApplier(defaults JobDefaults) JobTransformer

DefaultsApplier is a transformer that applies default values to the job.

func NameOptional added in v1.1.1

func NameOptional() JobTransformer

NameOptional is a transformer that sets the job name to the job ID if it is empty.

func NewInlineStoragePinner added in v1.2.0

func NewInlineStoragePinner(provider storage.StorageProvider) JobTransformer

NewInlineStoragePinner returns a job transformer that limits the inline space taken up by inline data. It will scan a job for StorageSpec objects that store their data inline and move any that are too large into IPFS storage. It also limits the total size taken up by inline specs and if this value is exceeded it will move the largest specs into IPFS.

func RequesterInfo added in v1.1.0

func RequesterInfo(requesterNodeID string) JobTransformer

RequesterInfo is a transformer that sets the requester ID in the job meta.

type ResultFn added in v1.1.4

type ResultFn func(context.Context, *models.SpecConfig) error

ResultFn is a function that implements ResultTransformer transform interface.

func (ResultFn) Transform added in v1.1.4

func (fn ResultFn) Transform(ctx context.Context, result *models.SpecConfig) error

type ResultTransformer added in v1.1.4

type ResultTransformer interface {
	GenericTransformer[*models.SpecConfig]
}

ResultTransformer is an interface that can be used to modify a result in place.

Jump to

Keyboard shortcuts

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