envoy

package
v0.0.0-...-2873e01 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TriggerToEnvoyNode

func TriggerToEnvoyNode(r *types.Trigger) (node *envoyx.Node, err error)

func WorkflowToEnvoyNode

func WorkflowToEnvoyNode(r *types.Workflow) (node *envoyx.Node, err error)

Types

type StoreDecoder

type StoreDecoder struct{}

StoreDecoder is responsible for generating Envoy nodes from already stored resources which can then be managed by Envoy and imported via an encoder.

func (StoreDecoder) Decode

func (d StoreDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)

Decode returns a set of envoy nodes based on the provided params

StoreDecoder expects the DecodeParam of `storer` and `dal` which conform to the store.Storer and dal.FullService interfaces.

type StoreEncoder

type StoreEncoder struct{}

StoreEncoder is responsible for encoding Corteza resources into the database via the Storer or the DAL interface

@todo consider having a different encoder for the DAL resources

func (StoreEncoder) Encode

func (e StoreEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tree envoyx.Traverser) (err error)

Encode encodes the given Corteza resources into the primary store

Encoding should not do any additional processing apart from matching with dependencies and runtime validation

The Encode function is called for every resource type where the resource appears at the root of the dependency tree. All of the root-level resources for that resource type are passed into the function. The encoding function must traverse the branches to encode all of the dependencies.

This flow is used to simplify the flow of how resources are encoded into YAML (and other documents) as well as to simplify batching.

Encode does not receive any placeholder nodes which are used solely for dependency resolution.

func (StoreEncoder) Prepare

func (e StoreEncoder) Prepare(ctx context.Context, p envoyx.EncodeParams, rt string, nn envoyx.NodeSet) (err error)

Prepare performs some initial processing on the resource before it can be encoded

Preparation runs validation, default value initialization, matching with already existing instances, ...

The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.

Prepare does not receive any placeholder nodes which are used solely for dependency resolution.

type YamlDecoder

type YamlDecoder struct{}

YamlDecoder is responsible for decoding YAML documents into Corteza resources which are then managed by envoy and imported via an encoder.

func (YamlDecoder) CanExt

func (d YamlDecoder) CanExt(name string) (ok bool)

CanExt returns true if the provided file extension can be decoded with this decoder

func (YamlDecoder) CanFile

func (d YamlDecoder) CanFile(f *os.File) (ok bool)

CanFile returns true if the provided file can be decoded with this decoder

func (YamlDecoder) Decode

func (d YamlDecoder) Decode(ctx context.Context, p envoyx.DecodeParams) (out envoyx.NodeSet, err error)

Decode returns a set of envoy nodes based on the provided params

YamlDecoder expects the DecodeParam of `stream` which conforms to the io.Reader interface.

type YamlEncoder

type YamlEncoder struct{}

YamlEncoder is responsible for encoding Corteza resources into a YAML supported format

func (YamlEncoder) Encode

func (e YamlEncoder) Encode(ctx context.Context, p envoyx.EncodeParams, rt string, nodes envoyx.NodeSet, tt envoyx.Traverser) (err error)

Encode encodes the given Corteza resources into some YAML supported format

Encoding should not do any additional processing apart from matching with dependencies and runtime validation

Preparation runs validation, default value initialization, matching with already existing instances, ...

The prepare function receives a set of nodes grouped by the resource type. This enables some batching optimization and simplifications when it comes to matching with existing resources.

Prepare does not receive any placeholder nodes which are used solely for dependency resolution.

Jump to

Keyboard shortcuts

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