modeltransformer

package
v0.0.0-...-86d635b Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TransformFunc

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

TransformFunc contains the threshold version string for transformation function and the transformationFunction itself. During upgrade, all models from versions below threshold version should execute the transformation function.

type Transformer

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

Transformer stores transformation functions for all types of objects. Transform<type> will execute a series of transformation functions to make it compatible with current agent version. add<type>TransformationFunctions will add more <type> transformation functions to the transformation functions chain. Add other transformation functions as needed. e.g. ContainerTransformationFunctions. Add corresponding Transform<Type> and Add<Type>TransformationFunctions while adding other transformation functions. Note that reverse transformation functions (downgrade) will not be applicable to transformer, as it is embedded with agent.

func NewTransformer

func NewTransformer() *Transformer

func (*Transformer) AddTaskTransformationFunctions

func (t *Transformer) AddTaskTransformationFunctions(version string, transformationFunc transformationFunctionClosure)

AddTaskTransformationFunctions adds the transformationFunction to the handling chain

func (*Transformer) GetNumberOfTransformationFunctions

func (t *Transformer) GetNumberOfTransformationFunctions(modelType string) int

GetNumberOfTransformationFunctions returns the number of transformation functions given a model type

func (*Transformer) IsUpgrade

func (t *Transformer) IsUpgrade(runningAgentVersion, persistedAgentVersion string) bool

IsUpgrade checks whether the load of a persisted model to running agent is an upgrade

func (*Transformer) TransformTask

func (t *Transformer) TransformTask(version string, data []byte) ([]byte, error)

TransformTask executes the transformation functions when version associated with model in boltdb is below the threshold

Jump to

Keyboard shortcuts

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