block

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenBlock     = "BLOCK"
	TokenDirective = "BLOCK_DIRECTIVE"
	TokenBlockBody = "BLOCK_BODY"
	TokenName      = "NAME"
)

Node tokens

Variables

View Source
var ContainerGracefulTimeoutSec = 10

ContainerGracefulTimeoutSec is the graceful timeout in seconds

Functions

func IsBlockSchema

func IsBlockSchema(s schema.Schema) bool

func NewInterpreter

func NewInterpreter(uri string) (conflow.BlockInterpreter, error)

func TransformChildren

func TransformChildren(
	parseCtx *conflow.ParseContext,
	blockID conflow.ID,
	nodes []parsley.Node,
	interpreter conflow.BlockInterpreter,
) ([]conflow.Node, conflow.Dependencies, parsley.Error)

func TransformMainNode

func TransformMainNode(ctx interface{}, node parsley.Node, id conflow.ID, interpreter conflow.BlockInterpreter) (parsley.Node, parsley.Error)

func TransformNode

func TransformNode(ctx interface{}, node parsley.Node, interpreter conflow.BlockInterpreter) (parsley.Node, parsley.Error)

Types

type Container

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

Container is a block container

func NewContainer

func NewContainer(
	evalCtx *conflow.EvalContext,
	runtimeConfig conflow.RuntimeConfig,
	node conflow.BlockNode,
	parent conflow.BlockContainer,
	value interface{},
	wgs []conflow.WaitGroup,
	pending bool,
) *Container

NewContainer creates a new block container instance

func (*Container) Cancel

func (c *Container) Cancel() bool

func (*Container) Close

func (c *Container) Close()

Close notifies all wait groups

func (*Container) EvalStage

func (c *Container) EvalStage() conflow.EvalStage

func (*Container) JobID

func (c *Container) JobID() int

JobID returns with the job id

func (*Container) JobName

func (c *Container) JobName() conflow.ID

SetJobID sets the job id

func (*Container) Lightweight

func (c *Container) Lightweight() bool

func (*Container) Node

func (c *Container) Node() conflow.Node

Node returns with the block node

func (*Container) Param

func (c *Container) Param(name conflow.ID) interface{}

Param returns with the parameter value

func (*Container) Pending

func (c *Container) Pending() bool

func (*Container) PublishBlock

func (c *Container) PublishBlock(block conflow.Block, f func() error) (bool, error)

func (*Container) Run

func (c *Container) Run()

func (*Container) SetChild

func (c *Container) SetChild(container conflow.Container)

SetChild sets a child container in a non-blocking way

func (*Container) SetError

func (c *Container) SetError(err parsley.Error)

func (*Container) SetJobID

func (c *Container) SetJobID(id int)

SetJobID sets the job id

func (*Container) Value

func (c *Container) Value() (interface{}, parsley.Error)

Value returns with the block or the error if any occurred If the block was skipped then a nil value is returned

func (*Container) WaitGroups

func (c *Container) WaitGroups() []conflow.WaitGroup

WaitGroups returns nil

type InterpreterRegistry

type InterpreterRegistry map[string]conflow.BlockInterpreter

InterpreterRegistry contains a list of block interpreters and behaves as a node transformer registry

func (InterpreterRegistry) NodeTransformer

func (i InterpreterRegistry) NodeTransformer(name string) (parsley.NodeTransformer, bool)

NodeTransformer returns with the named node transformer

func (InterpreterRegistry) Register

type Node

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

Node is a block node

func NewNode

func NewNode(
	idNode *conflow.IDNode,
	nameNode *conflow.NameNode,
	keyNode *terminal.StringNode,
	children []conflow.Node,
	token string,
	directives []conflow.BlockNode,
	readerPos parsley.Pos,
	interpreter conflow.BlockInterpreter,
	dependencies conflow.Dependencies,
) *Node

NewNode creates a new block node

func (*Node) BlockType

func (n *Node) BlockType() conflow.ID

BlockType returns with the type of block

func (*Node) Children

func (n *Node) Children() []conflow.Node

Children returns with the parameter and child block nodes

func (*Node) CreateContainer

func (n *Node) CreateContainer(
	ctx *conflow.EvalContext,
	runtimeConfig conflow.RuntimeConfig,
	parent conflow.BlockContainer,
	value interface{},
	wgs []conflow.WaitGroup,
	pending bool,
) conflow.JobContainer

func (*Node) Dependencies

func (n *Node) Dependencies() conflow.Dependencies

Dependencies returns the blocks/parameters this block depends on

func (*Node) Directives

func (n *Node) Directives() []conflow.BlockNode

Directives returns with the directive blocks

func (*Node) EvalStage

func (n *Node) EvalStage() conflow.EvalStage

EvalStage returns with the evaluation stage

func (*Node) Generates

func (n *Node) Generates() []conflow.ID

Generates returns true if any of the child blocks are generated

func (*Node) GetPropertySchema

func (n *Node) GetPropertySchema(name conflow.ID) (schema.Schema, bool)

func (*Node) ID

func (n *Node) ID() conflow.ID

ID returns with the id of the block

func (*Node) Interpreter

func (n *Node) Interpreter() conflow.BlockInterpreter

Interpreter returns with the interpreter

func (*Node) Key

func (n *Node) Key() *string

func (*Node) ParameterName

func (n *Node) ParameterName() conflow.ID

ParameterName returns with the parameter name

func (*Node) Pos

func (n *Node) Pos() parsley.Pos

Pos returns with the node's position

func (*Node) Provides

func (n *Node) Provides() []conflow.ID

Provides returns with the all the defined blocked node ids inside this block

func (*Node) ReaderPos

func (n *Node) ReaderPos() parsley.Pos

ReaderPos returns with the reader's position

func (*Node) Schema

func (n *Node) Schema() interface{}

Schema returns the schema for the node's value

func (*Node) SetReaderPos

func (n *Node) SetReaderPos(f func(parsley.Pos) parsley.Pos)

SetReaderPos amends the reader position using the given function

func (*Node) SetSchema

func (n *Node) SetSchema(s schema.Schema)

func (*Node) StaticCheck

func (n *Node) StaticCheck(ctx interface{}) parsley.Error

StaticCheck runs static analysis on the node

func (*Node) String

func (n *Node) String() string

func (*Node) Token

func (n *Node) Token() string

Token returns with the node's token

func (*Node) Value

func (n *Node) Value(userCtx interface{}) (interface{}, parsley.Error)

Value creates a new block

func (*Node) Walk

func (n *Node) Walk(f func(n parsley.Node) bool) bool

Walk runs the given function on all child nodes

type StaticContainer

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

StaticContainer is a container for blocks where there is no dynamic child evaluation required

func NewStaticContainer

func NewStaticContainer(
	evalCtx *conflow.EvalContext,
	node conflow.BlockNode,
) *StaticContainer

NewStaticContainer creates a new static block container instance

func (*StaticContainer) Cancel

func (s *StaticContainer) Cancel() bool

func (*StaticContainer) Close

func (s *StaticContainer) Close()

func (*StaticContainer) EvalStage

func (s *StaticContainer) EvalStage() conflow.EvalStage

func (*StaticContainer) JobID

func (s *StaticContainer) JobID() int

func (*StaticContainer) JobName

func (s *StaticContainer) JobName() conflow.ID

func (*StaticContainer) Lightweight

func (s *StaticContainer) Lightweight() bool

func (*StaticContainer) Node

func (s *StaticContainer) Node() conflow.Node

Node returns with the block node

func (*StaticContainer) Pending

func (s *StaticContainer) Pending() bool

func (*StaticContainer) Run

func (s *StaticContainer) Run()

func (*StaticContainer) SetJobID

func (s *StaticContainer) SetJobID(jobID int)

func (*StaticContainer) Value

func (s *StaticContainer) Value() (interface{}, parsley.Error)

Value returns with the block or the error if any occurred If the block was skipped then a nil value is returned

func (*StaticContainer) WaitGroups

func (s *StaticContainer) WaitGroups() []conflow.WaitGroup

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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