protocol

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 23 Imported by: 6

Documentation

Index

Constants

View Source
const I18n = "i18n"

I18n ${{ i18n.button }} i18n prefix

Variables

View Source
var CpPlaceHolderRe = regexp.MustCompile(`\${{[ ]{1}([^{}\s]+)[ ]{1}}}`)

CpPlaceHolderRe ${{ configs.key }} only one space

View Source
var ScenarioRenders = make(map[string]*ScenarioRender)

ScenarioRenders contains all scenario renders.

Functions

func GetGlobalStateKV

func GetGlobalStateKV(p *cptype.ComponentProtocol, key string) interface{}

GetGlobalStateKV .

func MustRegisterComponent

func MustRegisterComponent(r *CompRenderSpec)

MustRegisterComponent .

func MustRegisterProtocolsFromFS

func MustRegisterProtocolsFromFS(rootFS embed.FS)

MustRegisterProtocolsFromFS registry protocols from embed fs.

func RegisterComponent

func RegisterComponent(r *CompRenderSpec) error

RegisterComponent register a component under scenario

func RegisterDefaultProtocols

func RegisterDefaultProtocols(protocolYAMLs ...[]byte)

RegisterDefaultProtocols register protocol contents.

func RegisterDefaultProtocolsFromBasePath

func RegisterDefaultProtocolsFromBasePath(basePath string)

RegisterDefaultProtocolsFromBasePath register default component protocols under base path. default path: libs/erda-configs/permission

func RunScenarioRender

func RunScenarioRender(ctx context.Context, req *cptype.ComponentProtocolRequest) error

RunScenarioRender .

Types

type CompRender

type CompRender interface {
	Render(ctx context.Context, c *cptype.Component, scenario cptype.Scenario, event cptype.ComponentEvent, gs *cptype.GlobalStateData) error
}

CompRender .

type CompRenderSpec

type CompRenderSpec struct {
	// Scenario key
	Scenario string `json:"scenario"`
	// CompName is component name
	CompName string `json:"name"`
	// RenderC used to created component
	RenderC RenderCreator
	// Creator used to create component instance
	Creator ComponentCreator
}

CompRenderSpec .

type ComponentCreator

type ComponentCreator func() cptype.IComponent

ComponentCreator .

type FRAMEWORK

type FRAMEWORK struct {
	IC cptype.IComponent
}

FRAMEWORK .

func (FRAMEWORK) Render

func (F FRAMEWORK) Render(ctx context.Context, c *cptype.Component, scenario cptype.Scenario, event cptype.ComponentEvent, gs *cptype.GlobalStateData) (err error)

Render .

type Node

type Node struct {
	Name     string
	Parallel bool

	NextNodes []*Node

	PreviousNode *Node

	BindingStates []cptype.RendingState
	// contains filtered or unexported fields
}

Node used for parallel rendering.

func (*Node) String

func (n *Node) String() string

type RenderCreator

type RenderCreator func() CompRender

RenderCreator .

type ScenarioRender

type ScenarioRender map[string]*CompRenderSpec

ScenarioRender is a group of component renders. key: componentName value: componentRender

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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