context

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigMapKeyComponents is the key in ConfigMap Data field for containing data of components
	ConfigMapKeyComponents = "components"
	// ConfigMapKeyVars is the key in ConfigMap Data field for containing data of variable
	ConfigMapKeyVars = "vars"
	// AnnotationStartTimestamp is the annotation key of the workflow start  timestamp
	AnnotationStartTimestamp = "vela.io/startTime"
)

Variables

View Source
var (
	// EnableInMemoryContext optimize workflow context storage by storing it in memory instead of etcd
	EnableInMemoryContext = false
)
View Source
var MemStore = &inMemoryContextStorage{
	contexts: map[string]*v1.ConfigMap{},
}

MemStore store in-memory context

Functions

func CleanupMemoryStore added in v1.2.2

func CleanupMemoryStore(app, ns string)

CleanupMemoryStore cleans up memory store.

Types

type ComponentManifest

type ComponentManifest struct {
	Workload    model.Instance
	Auxiliaries []model.Instance
}

ComponentManifest contains resources rendered from an application component.

func (*ComponentManifest) Patch

func (comp *ComponentManifest) Patch(patchValue *value.Value) error

Patch the ComponentManifest with value

type Context

type Context interface {
	GetComponent(name string) (*ComponentManifest, error)
	GetComponents() map[string]*ComponentManifest
	PatchComponent(name string, patchValue *value.Value) error
	GetVar(paths ...string) (*value.Value, error)
	SetVar(v *value.Value, paths ...string) error
	GetStore() *corev1.ConfigMap
	GetMutableValue(path ...string) string
	SetMutableValue(data string, path ...string)
	DeleteMutableValue(paths ...string)
	IncreaseCountValueInMemory(paths ...string) int
	SetValueInMemory(data interface{}, paths ...string)
	GetValueInMemory(paths ...string) (interface{}, bool)
	DeleteValueInMemory(paths ...string)
	Commit() error
	MakeParameter(parameter interface{}) (*value.Value, error)
	StoreRef() *corev1.ObjectReference
}

Context is workflow context interface

func LoadContext

func LoadContext(cli client.Client, ns, app string) (Context, error)

LoadContext load workflow context from store.

func NewContext

func NewContext(cli client.Client, ns, app string, appUID types.UID) (Context, error)

NewContext new workflow context without initialize data.

type WorkflowContext

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

WorkflowContext is workflow context.

func (*WorkflowContext) Commit

func (wf *WorkflowContext) Commit() error

Commit the workflow context and persist it's content.

func (*WorkflowContext) DeleteMutableValue added in v1.2.0

func (wf *WorkflowContext) DeleteMutableValue(paths ...string)

DeleteMutableValue delete mutable data in workflow context.

func (*WorkflowContext) DeleteValueInMemory added in v1.2.2

func (wf *WorkflowContext) DeleteValueInMemory(paths ...string)

DeleteValueInMemory delete data in workflow context memory store.

func (*WorkflowContext) GetComponent

func (wf *WorkflowContext) GetComponent(name string) (*ComponentManifest, error)

GetComponent Get ComponentManifest from workflow context.

func (*WorkflowContext) GetComponents

func (wf *WorkflowContext) GetComponents() map[string]*ComponentManifest

GetComponents Get All ComponentManifest from workflow context.

func (*WorkflowContext) GetMutableValue added in v1.2.0

func (wf *WorkflowContext) GetMutableValue(paths ...string) string

GetMutableValue get mutable data from workflow context.

func (*WorkflowContext) GetStore added in v1.2.0

func (wf *WorkflowContext) GetStore() *corev1.ConfigMap

GetStore get store of workflow context.

func (*WorkflowContext) GetValueInMemory added in v1.2.2

func (wf *WorkflowContext) GetValueInMemory(paths ...string) (interface{}, bool)

GetValueInMemory get data in workflow context memory store.

func (*WorkflowContext) GetVar

func (wf *WorkflowContext) GetVar(paths ...string) (*value.Value, error)

GetVar get variable from workflow context.

func (*WorkflowContext) IncreaseCountValueInMemory added in v1.2.2

func (wf *WorkflowContext) IncreaseCountValueInMemory(paths ...string) int

IncreaseCountValueInMemory increase count in workflow context memory store.

func (*WorkflowContext) LoadFromConfigMap

func (wf *WorkflowContext) LoadFromConfigMap(cm corev1.ConfigMap) error

LoadFromConfigMap recover workflow context from configMap.

func (*WorkflowContext) MakeParameter

func (wf *WorkflowContext) MakeParameter(parameter interface{}) (*value.Value, error)

MakeParameter make 'value' with interface{}

func (*WorkflowContext) PatchComponent

func (wf *WorkflowContext) PatchComponent(name string, patchValue *value.Value) error

PatchComponent patch component with value.

func (*WorkflowContext) SetMutableValue added in v1.2.0

func (wf *WorkflowContext) SetMutableValue(data string, paths ...string)

SetMutableValue set mutable data in workflow context config map.

func (*WorkflowContext) SetValueInMemory added in v1.2.2

func (wf *WorkflowContext) SetValueInMemory(data interface{}, paths ...string)

SetValueInMemory set data in workflow context memory store.

func (*WorkflowContext) SetVar

func (wf *WorkflowContext) SetVar(v *value.Value, paths ...string) error

SetVar set variable to workflow context.

func (*WorkflowContext) StoreRef

func (wf *WorkflowContext) StoreRef() *corev1.ObjectReference

StoreRef return the store reference of workflow context.

Jump to

Keyboard shortcuts

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