translation

package
v1.4.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldTranslate

func ShouldTranslate(ctx context.Context, provider TranslatorProvider, tasks []*models.Task) (bool, error)

ShouldTranslate works out whether we need to carry on with translation, that is are there any engine types specified that are not a default engine and we know how to translate. If not, then we can exit early.

func Translate

func Translate(ctx context.Context, provider TranslatorProvider, original *models.Job) (*models.Job, error)

Translate attempts to translate from one job to another, based on the engine type of the tasks in the job. After ensuring that each of the tasks is either a default (docker, wasm) or available via the provider, then a new Job is cloned from the original and the individual tasks updated.

Types

type Translator

type Translator interface {
	provider.Providable

	Translate(*models.Task) (*models.Task, error)
}

Translator defines what functions are required for a component that is able to translate from one job to another. It is important that implementers ensure that their implementation is reentrant - which means it should not use any mutable state after initialization.

type TranslatorProvider

type TranslatorProvider interface {
	provider.Provider[Translator]
}

TranslatorProvider is an alias for `provider.Provider[Translator]`

func NewStandardTranslatorsProvider

func NewStandardTranslatorsProvider() TranslatorProvider

NewStandardTranslatorsProvider returns a TranslatorProvider which maps names to implementations of the Translator interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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