conflow

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 (
	BlockTypeConfiguration = "configuration"
	BlockTypeDirective     = "directive"
	BlockTypeGenerator     = "generator"
	BlockTypeMain          = "main"
	BlockTypeTask          = "task"
)
View Source
const (
	ClassifierNone       = rune(0)
	ClassifierAnnotation = '@'
)
View Source
const FunctionNameRegExpPattern = schema.NameRegExpPattern + "(?:\\." + schema.NameRegExpPattern + ")?"

FunctionNameRegExpPattern defines a valid function name

View Source
const LogTimeFormat = "2006-01-02T15:04:05.000Z07:00"

Variables

View Source
var EvalStages = map[string]EvalStage{
	"parse":   EvalStageParse,
	"resolve": EvalStageResolve,
	"init":    EvalStageInit,
	"main":    EvalStageMain,
	"close":   EvalStageClose,
	"ignore":  EvalStageIgnore,
}

EvalStages returns with the evaluation stages

View Source
var Keywords = []string{
	"map",
}

Keywords are reserved strings and may not be used as identifiers.

View Source
var Version = "v0.0.0"

Functions

func Evaluate

func Evaluate(
	parseCtx *ParseContext,
	context context.Context,
	userContext interface{},
	logger Logger,
	scheduler JobScheduler,
	id ID,
	inputParams map[ID]interface{},
) (interface{}, error)

Evaluate will evaluate the given node which was previously parsed with the passed parse context

func ParseFile

func ParseFile(ctx *ParseContext, p parsley.Parser, path string) (parsley.Node, error)

ParseFile parses a file with the given parser

func ParseFiles

func ParseFiles(
	ctx *ParseContext,
	p parsley.Parser,
	nodeBuilder func(nodes []parsley.Node) parsley.Node,
	paths []string,
) error

ParseFiles parses multiple files as one The result node will be created using the nodeBuilder function The transformation and the static checking will run on the built node

func ParseText

func ParseText(ctx *ParseContext, p parsley.Parser, input string) (parsley.Node, error)

ParseText parses the text input with the given parser

func RetryableError

func RetryableError(err error, duration time.Duration) error

RetryableError wraps the given error and makes it retryable

Types

type Block

type Block interface {
}

Block is an interface for a block object

type BlockCloser

type BlockCloser interface {
	Close(ctx context.Context) error
}

BlockCloser defines a Close function which runs after the main evaluation stage

type BlockContainer

type BlockContainer interface {
	Container
	Param(ID) interface{}
	SetChild(Container)
	SetError(parsley.Error)
	EvalStage() EvalStage
}

BlockContainer is a simple wrapper around a block object

type BlockContext

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

func NewBlockContext

func NewBlockContext(
	evalContext *EvalContext,
	blockPublisher BlockPublisher,
) *BlockContext

NewBlockContext creates a new block context

func (*BlockContext) BlockPublisher

func (b *BlockContext) BlockPublisher() BlockPublisher

func (*BlockContext) JobScheduler

func (b *BlockContext) JobScheduler() JobScheduler

func (*BlockContext) Logger

func (b *BlockContext) Logger() Logger

func (*BlockContext) Stdout

func (b *BlockContext) Stdout() io.Writer

func (*BlockContext) UserContext

func (b *BlockContext) UserContext() interface{}

type BlockDirective

type BlockDirective interface {
	Block
	RuntimeConfigOption
}

BlockDirective provides a way to add metadata or define alternate runtime execution for blocks

type BlockInitialiser

type BlockInitialiser interface {
	Init(context.Context) (skipped bool, err error)
}

BlockInitialiser defines an Init() function which runs before the main evaluation stage If the skipped return value is true then the block won't be evaluated

type BlockInterpreter

type BlockInterpreter interface {
	Schema() schema.Schema
	CreateBlock(ID, *BlockContext) Block
	SetParam(b Block, name ID, value interface{}) error
	SetBlock(b Block, name ID, key string, value interface{}) error
	Param(b Block, name ID) interface{}
	ValueParamName() ID
	ParseContext(*ParseContext) *ParseContext
}

BlockInterpreter defines an interpreter for blocks

type BlockNode

type BlockNode interface {
	Node
	Children() []Node
	ParameterName() ID
	BlockType() ID
	Interpreter() BlockInterpreter
	SetSchema(schema.Schema)
	GetPropertySchema(ID) (schema.Schema, bool)
	Key() *string
}

BlockNode is the AST node for a block

type BlockNodeRegistry

type BlockNodeRegistry interface {
	BlockNode(ID) (BlockNode, bool)
	AddBlockNode(BlockNode) error
}

BlockNodeRegistry is an interface for looking up named blocks

type BlockProvider

type BlockProvider interface {
	BlockInterpreters(*ParseContext) (map[ID]BlockInterpreter, error)
}

BlockProvider is an interface for an object which provides additional block types

type BlockPublisher

type BlockPublisher interface {
	PublishBlock(block Block, onScheduled func() error) (published bool, err error)
}

BlockPublisher defines an interface which generator blocks should use to publish generated blocks The PublishBlock function will either:

  • return immediately with published=false if the block is not a dependency of other blocks
  • otherwise it will block until all other blocks depending on the published block will finish running

If the onScheduled function is not nil, it will be called after the published block was scheduled

type BlockRunner

type BlockRunner interface {
	Run(ctx context.Context) (Result, error)
}

BlockRunner defines a Run() function which runs the main business logic

type BlockTransformerRegistryAware

type BlockTransformerRegistryAware interface {
	BlockTransformerRegistry() parsley.NodeTransformerRegistry
}

BlockTransformerRegistryAware is an interface to get a block node transformer registry

type Container

type Container interface {
	Node() Node
	Value() (interface{}, parsley.Error)
	WaitGroups() []WaitGroup
	Close()
}

Container is a conflow object container

func NewNilContainer

func NewNilContainer(node Node, wgs []WaitGroup, pending bool) Container

NewNilContainer creates a new nil container

type Contexter

type Contexter interface {
	Context(ctx context.Context) (context.Context, context.CancelFunc)
}

Context defines an interface about creating a new context

type Dependencies

type Dependencies map[ID]VariableNode

Dependencies is a variable list

func (Dependencies) Add

func (d Dependencies) Add(d2 Dependencies)

type DirectiveTransformerRegistryAware

type DirectiveTransformerRegistryAware interface {
	DirectiveTransformerRegistry() parsley.NodeTransformerRegistry
}

DirectiveTransformerRegistryAware is an interface to get a block node transformer registry

type EvalContext

type EvalContext struct {
	UserContext interface{}
	Logger      Logger

	Stdout      io.Writer
	InputParams map[ID]interface{}
	// contains filtered or unexported fields
}

EvalContext is the evaluation context

func NewEvalContext

func NewEvalContext(
	ctx context.Context,
	userContext interface{},
	logger Logger,
	jobScheduler JobScheduler,
	dependencies map[ID]BlockContainer,
) *EvalContext

NewEvalContext returns with a new evaluation context

func (*EvalContext) BlockContainer

func (e *EvalContext) BlockContainer(id ID) (BlockContainer, bool)

BlockContainer returns with the given block container instance if it exists

func (*EvalContext) Cancel

func (e *EvalContext) Cancel() bool

func (*EvalContext) Deadline

func (e *EvalContext) Deadline() (deadline time.Time, ok bool)

func (*EvalContext) Done

func (e *EvalContext) Done() <-chan struct{}

func (*EvalContext) Err

func (e *EvalContext) Err() error

func (*EvalContext) HasSubscribers

func (e *EvalContext) HasSubscribers(id ID) bool

func (*EvalContext) JobScheduler

func (e *EvalContext) JobScheduler() JobScheduler

func (*EvalContext) New

func (e *EvalContext) New(
	ctx context.Context,
	cancel context.CancelFunc,
	dependencies map[ID]BlockContainer,
) *EvalContext

New creates a new eval context by copying the parent and overriding the provided values

func (*EvalContext) Publish

func (e *EvalContext) Publish(c Container)

func (*EvalContext) Run

func (e *EvalContext) Run() bool

func (*EvalContext) SetStdout

func (e *EvalContext) SetStdout(stdout io.Writer)

func (*EvalContext) Subscribe

func (e *EvalContext) Subscribe(container *NodeContainer, id ID)

func (*EvalContext) Unsubscribe

func (e *EvalContext) Unsubscribe(container *NodeContainer, id ID)

func (*EvalContext) Value

func (e *EvalContext) Value(key interface{}) interface{}

type EvalStage

type EvalStage int8

EvalStage means an evaluation stage (default, pre or post)

const (
	EvalStageUndefined EvalStage = iota
	EvalStageParse
	EvalStageResolve
	EvalStageInit
	EvalStageMain
	EvalStageClose
	EvalStageIgnore
)

Evaluation stages

func (EvalStage) String

func (e EvalStage) String() string

type FunctionInterpreter

type FunctionInterpreter interface {
	Schema() schema.Schema
	Eval(ctx interface{}, args []interface{}) (interface{}, error)
}

FunctionInterpreter defines an interpreter for functions

type FunctionNode

type FunctionNode interface {
	parsley.Node
	parsley.StaticCheckable
	Name() ID
	ArgumentNodes() []parsley.Node
}

FunctionNode is the AST node for a function

type FunctionTransformerRegistryAware

type FunctionTransformerRegistryAware interface {
	FunctionTransformerRegistry() parsley.NodeTransformerRegistry
}

FunctionTransformerRegistryAware is an interface to get a function node transformer registry

type ID

type ID string

ID contains an identifier

func (ID) Concat

func (i ID) Concat(s string) ID

func (ID) String

func (i ID) String() string

String returns with the ID string

type IDNode

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

IDNode contains an identifier

func NewIDNode

func NewIDNode(id ID, classifier rune, pos parsley.Pos, readerPos parsley.Pos) *IDNode

NewIDNode creates a new id node

func (*IDNode) Classifier

func (i *IDNode) Classifier() rune

Classifier returns with classifier of the id A classifier is a single rune, like '@', '$', '&'.

func (*IDNode) ID

func (i *IDNode) ID() ID

ID returns with the identifier string

func (*IDNode) Pos

func (i *IDNode) Pos() parsley.Pos

Pos returns the position

func (*IDNode) ReaderPos

func (i *IDNode) ReaderPos() parsley.Pos

ReaderPos returns the position of the first character immediately after this node

func (*IDNode) Schema

func (i *IDNode) Schema() interface{}

Schema returns the schema for the node's value

func (*IDNode) SetReaderPos

func (i *IDNode) SetReaderPos(f func(parsley.Pos) parsley.Pos)

SetReaderPos changes the reader position

func (*IDNode) String

func (i *IDNode) String() string

String returns with a string representation of the node

func (*IDNode) Token

func (i *IDNode) Token() string

Token returns with the node token

func (*IDNode) Value

func (i *IDNode) Value() interface{}

ValueOf returns with the id of the node

type IDRegistry

type IDRegistry interface {
	IDExists(id ID) bool
	RegisterID(id ID) error
	GenerateID() ID
}

IDRegistry generates and stores identifiers

func NewIDRegistry

func NewIDRegistry(minLength int, maxLength int) IDRegistry

type Identifiable

type Identifiable interface {
	ID() ID
}

Identifiable makes an object to have a string identifier and have an identifiable parent

type Job

type Job interface {
	JobName() ID
	JobID() int
	SetJobID(int)
	Run()
	Lightweight() bool
}

Job is a unit of work the scheduler can schedule and run

type JobContainer

type JobContainer interface {
	Job
	Container
	Cancel() bool
	Pending() bool
	EvalStage() EvalStage
}

type JobScheduler

type JobScheduler interface {
	ScheduleJob(job Job) error
}

JobScheduler is the job scheduler

type LogArray

type LogArray interface {
	LogArrayMarshaler
	Object(obj LogObjectMarshaler) LogArray
	ID(val ID) LogArray
	Str(val string) LogArray
	Bytes(val []byte) LogArray
	Hex(val []byte) LogArray
	Err(err error) LogArray
	Bool(b bool) LogArray
	Int(i int) LogArray
	Int8(i int8) LogArray
	Int16(i int16) LogArray
	Int32(i int32) LogArray
	Int64(i int64) LogArray
	Uint(i uint) LogArray
	Uint8(i uint8) LogArray
	Uint16(i uint16) LogArray
	Uint32(i uint32) LogArray
	Uint64(i uint64) LogArray
	Float32(f float32) LogArray
	Float64(f float64) LogArray
	Time(t time.Time) LogArray
	Dur(d time.Duration) LogArray
	Interface(i interface{}) LogArray
	IPAddr(ip net.IP) LogArray
	IPPrefix(pfx net.IPNet) LogArray
	MACAddr(ha net.HardwareAddr) LogArray
}

type LogArrayMarshaler

type LogArrayMarshaler interface {
	MarshalLogArray(a LogArray)
}

type LogEvent

type LogEvent interface {
	Enabled() bool
	Discard() LogEvent
	Msg(msg string)
	Msgf(format string, v ...interface{})
	Fields(fields map[string]interface{}) LogEvent
	Dict(key string, dict LogEvent) LogEvent
	Array(key string, arr LogArrayMarshaler) LogEvent
	Object(key string, obj LogObjectMarshaler) LogEvent
	EmbedObject(obj LogObjectMarshaler) LogEvent
	ID(key string, val ID) LogEvent
	Str(key, val string) LogEvent
	Strs(key string, vals []string) LogEvent
	Bytes(key string, val []byte) LogEvent
	Hex(key string, val []byte) LogEvent
	RawJSON(key string, b []byte) LogEvent
	AnErr(key string, err error) LogEvent
	Errs(key string, errs []error) LogEvent
	Err(err error) LogEvent
	Stack() LogEvent
	Bool(key string, b bool) LogEvent
	Bools(key string, b []bool) LogEvent
	Int(key string, i int) LogEvent
	Ints(key string, i []int) LogEvent
	Int8(key string, i int8) LogEvent
	Ints8(key string, i []int8) LogEvent
	Int16(key string, i int16) LogEvent
	Ints16(key string, i []int16) LogEvent
	Int32(key string, i int32) LogEvent
	Ints32(key string, i []int32) LogEvent
	Int64(key string, i int64) LogEvent
	Ints64(key string, i []int64) LogEvent
	Uint(key string, i uint) LogEvent
	Uints(key string, i []uint) LogEvent
	Uint8(key string, i uint8) LogEvent
	Uints8(key string, i []uint8) LogEvent
	Uint16(key string, i uint16) LogEvent
	Uints16(key string, i []uint16) LogEvent
	Uint32(key string, i uint32) LogEvent
	Uints32(key string, i []uint32) LogEvent
	Uint64(key string, i uint64) LogEvent
	Uints64(key string, i []uint64) LogEvent
	Float32(key string, f float32) LogEvent
	Floats32(key string, f []float32) LogEvent
	Float64(key string, f float64) LogEvent
	Floats64(key string, f []float64) LogEvent
	Timestamp() LogEvent
	Time(key string, t time.Time) LogEvent
	Times(key string, t []time.Time) LogEvent
	Dur(key string, d time.Duration) LogEvent
	Durs(key string, d []time.Duration) LogEvent
	TimeDiff(key string, t time.Time, start time.Time) LogEvent
	Interface(key string, i interface{}) LogEvent
	Caller() LogEvent
	IPAddr(key string, ip net.IP) LogEvent
	IPPrefix(key string, pfx net.IPNet) LogEvent
	MACAddr(key string, ha net.HardwareAddr) LogEvent
}

LogEvent is an interface for enriching and sending log events

type LogObjectMarshaler

type LogObjectMarshaler interface {
	MarshalLogObject(e LogEvent)
}

type Logger

type Logger interface {
	With() LoggerContext
	Debug() LogEvent
	Info() LogEvent
	Warn() LogEvent
	Error() LogEvent
	Fatal() LogEvent
	Panic() LogEvent
	Log() LogEvent
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Array() LogArray
}

Logger is an interface for structured logging

type LoggerContext

type LoggerContext interface {
	Logger() Logger
	Fields(fields map[string]interface{}) LoggerContext
	Dict(key string, dict LogEvent) LoggerContext
	Array(key string, arr LogArrayMarshaler) LoggerContext
	Object(key string, obj LogObjectMarshaler) LoggerContext
	EmbedObject(obj LogObjectMarshaler) LoggerContext
	ID(key string, val ID) LoggerContext
	Str(key, val string) LoggerContext
	Strs(key string, vals []string) LoggerContext
	Bytes(key string, val []byte) LoggerContext
	Hex(key string, val []byte) LoggerContext
	RawJSON(key string, b []byte) LoggerContext
	AnErr(key string, err error) LoggerContext
	Errs(key string, errs []error) LoggerContext
	Err(err error) LoggerContext
	Bool(key string, b bool) LoggerContext
	Bools(key string, b []bool) LoggerContext
	Int(key string, i int) LoggerContext
	Ints(key string, i []int) LoggerContext
	Int8(key string, i int8) LoggerContext
	Ints8(key string, i []int8) LoggerContext
	Int16(key string, i int16) LoggerContext
	Ints16(key string, i []int16) LoggerContext
	Int32(key string, i int32) LoggerContext
	Ints32(key string, i []int32) LoggerContext
	Int64(key string, i int64) LoggerContext
	Ints64(key string, i []int64) LoggerContext
	Uint(key string, i uint) LoggerContext
	Uints(key string, i []uint) LoggerContext
	Uint8(key string, i uint8) LoggerContext
	Uints8(key string, i []uint8) LoggerContext
	Uint16(key string, i uint16) LoggerContext
	Uints16(key string, i []uint16) LoggerContext
	Uint32(key string, i uint32) LoggerContext
	Uints32(key string, i []uint32) LoggerContext
	Uint64(key string, i uint64) LoggerContext
	Uints64(key string, i []uint64) LoggerContext
	Float32(key string, f float32) LoggerContext
	Floats32(key string, f []float32) LoggerContext
	Float64(key string, f float64) LoggerContext
	Floats64(key string, f []float64) LoggerContext
	Timestamp() LoggerContext
	Time(key string, t time.Time) LoggerContext
	Times(key string, t []time.Time) LoggerContext
	Dur(key string, d time.Duration) LoggerContext
	Durs(key string, d []time.Duration) LoggerContext
	Interface(key string, i interface{}) LoggerContext
	Caller() LoggerContext
	CallerWithSkipFrameCount(skipFrameCount int) LoggerContext
	Stack() LoggerContext
	IPAddr(key string, ip net.IP) LoggerContext
	IPPrefix(key string, pfx net.IPNet) LoggerContext
	MACAddr(key string, ha net.HardwareAddr) LoggerContext
}

LoggerContext is an interface for setting up child loggers

type Loggerer

type Loggerer interface {
	Logger(logger Logger) Logger
}

Loggerer defines an interface about creating a new logger

type NameNode

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

NameNode contains a name node A name node consists of one identifier, or two separated by a single character

func NewNameNode

func NewNameNode(selector *IDNode, sep parsley.LiteralNode, name *IDNode) *NameNode

NewNameNode creates a new name node type

func (*NameNode) NameNode

func (t *NameNode) NameNode() *IDNode

NameNode returns with the name node

func (*NameNode) Pos

func (t *NameNode) Pos() parsley.Pos

Pos returns the position

func (*NameNode) ReaderPos

func (t *NameNode) ReaderPos() parsley.Pos

ReaderPos returns the position of the first character immediately after this node

func (*NameNode) Schema

func (t *NameNode) Schema() interface{}

Schema returns the schema for the node's value

func (*NameNode) SelectorNode

func (t *NameNode) SelectorNode() *IDNode

SelectorNode returns with selector node A selector can be e.g. a package name for functions, or the parameter name for block types

func (*NameNode) SetReaderPos

func (t *NameNode) SetReaderPos(f func(parsley.Pos) parsley.Pos)

SetReaderPos changes the reader position

func (*NameNode) String

func (t *NameNode) String() string

String returns with a string representation of the node

func (*NameNode) Token

func (t *NameNode) Token() string

Token returns with the node token

func (*NameNode) Value

func (t *NameNode) Value() interface{}

ValueOf returns with the block type

type NilContainer

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

NilContainer is a container which evaluates to nil

func (NilContainer) Close

func (n NilContainer) Close()

func (NilContainer) Node

func (n NilContainer) Node() Node

func (NilContainer) Pending

func (n NilContainer) Pending() bool

func (NilContainer) Value

func (n NilContainer) Value() (interface{}, parsley.Error)

func (NilContainer) WaitGroups

func (n NilContainer) WaitGroups() []WaitGroup

type Node

type Node interface {
	parsley.Node
	Identifiable
	EvalStage() EvalStage
	Dependencies() Dependencies
	Directives() []BlockNode
	Provides() []ID
	Generates() []ID
	CreateContainer(
		ctx *EvalContext,
		runtimeConfig RuntimeConfig,
		parent BlockContainer,
		value interface{},
		wgs []WaitGroup,
		pending bool,
	) JobContainer
	Value(userCtx interface{}) (interface{}, parsley.Error)
}

Node is an identifiable node which has dependencies and has an evaluation stage

type NodeContainer

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

NodeContainer wraps a node and registers the dependencies as they become available

func NewNodeContainer

func NewNodeContainer(
	ctx *EvalContext,
	parent BlockContainer,
	node Node,
	scheduler JobScheduler,
) (*NodeContainer, parsley.Error)

NewNodeContainer creates a new node container

func (*NodeContainer) Close

func (n *NodeContainer) Close()

func (*NodeContainer) CreateContainer

func (n *NodeContainer) CreateContainer(value interface{}, wgs []WaitGroup) (JobContainer, parsley.Error)

func (*NodeContainer) Node

func (n *NodeContainer) Node() Node

Node returns with the node

func (*NodeContainer) Run

func (n *NodeContainer) Run() (pending bool, err parsley.Error)

Run will schedule the node if it's ready. If the node is not ready, then it will return with pending true

func (*NodeContainer) SetDependency

func (n *NodeContainer) SetDependency(dep Container)

SetDependency stores the given container If all dependencies are set on the node then it will schedule the node for running.

type ParameterConfig

type ParameterConfig struct {
	Input    *bool
	Required *bool
	Output   *bool
	Schema   schema.Schema
}

func (ParameterConfig) ApplyToParameterConfig

func (p ParameterConfig) ApplyToParameterConfig(p2 *ParameterConfig)

type ParameterConfigOption

type ParameterConfigOption interface {
	ApplyToParameterConfig(*ParameterConfig)
}

type ParameterContainer

type ParameterContainer interface {
	Container
	BlockContainer() BlockContainer
}

ParameterContainer is a parameter container

type ParameterDirective

type ParameterDirective interface {
	Block
	ApplyToParameterConfig(*ParameterConfig)
}

ParameterDirective provides a way to add metadata for parameters

type ParameterNode

type ParameterNode interface {
	Node
	parsley.StaticCheckable
	Name() ID
	ValueNode() parsley.Node
	IsDeclaration() bool
	SetSchema(schema.Schema)
}

ParameterNode is the AST node for a parameter

type ParseContext

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

ParseContext is the parsing context

func NewParseContext

func NewParseContext(
	fileset *parsley.FileSet,
	idRegistry IDRegistry,
	directiveTransformerRegistry parsley.NodeTransformerRegistry,
) *ParseContext

NewParseContext returns with a new parsing context

func (*ParseContext) AddBlockNode

func (p *ParseContext) AddBlockNode(node BlockNode) error

AddBlockNode adds a new block node It returns with an error if a block with the same id was already registered

func (*ParseContext) BlockNode

func (p *ParseContext) BlockNode(id ID) (BlockNode, bool)

BlockNode returns with the given block node if it exists

func (*ParseContext) BlockTransformerRegistry

func (p *ParseContext) BlockTransformerRegistry() parsley.NodeTransformerRegistry

BlockTransformerRegistry returns with the block node transformer registry

func (*ParseContext) DirectiveTransformerRegistry

func (p *ParseContext) DirectiveTransformerRegistry() parsley.NodeTransformerRegistry

DirectiveTransformerRegistry returns with the directive node transformer registry

func (*ParseContext) FileSet

func (p *ParseContext) FileSet() *parsley.FileSet

FileSet returns with the file set

func (*ParseContext) FunctionTransformerRegistry

func (p *ParseContext) FunctionTransformerRegistry() parsley.NodeTransformerRegistry

FunctionTransformerRegistry returns with the function node transformer registry

func (*ParseContext) GenerateID

func (p *ParseContext) GenerateID() ID

GenerateID generates a new id

func (*ParseContext) IDExists

func (p *ParseContext) IDExists(id ID) bool

IDExists returns true if the identifier already exists

func (*ParseContext) New

New creates a new child context

func (*ParseContext) NewForModule

func (p *ParseContext) NewForModule() *ParseContext

func (*ParseContext) RegisterID

func (p *ParseContext) RegisterID(id ID) error

RegisterID registers a new id and returns an error if it was already registered

type ParseContextOverride

type ParseContextOverride struct {
	BlockTransformerRegistry     parsley.NodeTransformerRegistry
	FunctionTransformerRegistry  parsley.NodeTransformerRegistry
	DirectiveTransformerRegistry parsley.NodeTransformerRegistry
}

ParseContextOverride stores override values for a parse context

type ParseContextOverrider

type ParseContextOverrider interface {
	ParseContextOverride() ParseContextOverride
}

ParseContextOverrider defines an interface to be able to override a parse config

type PubSub

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

func NewPubSub

func NewPubSub() *PubSub

func (*PubSub) HasSubscribers

func (p *PubSub) HasSubscribers(id ID) bool

HasSubscribers will return true if the given block has subscribers

func (*PubSub) Publish

func (p *PubSub) Publish(c Container)

Publish will notify all node containers which are subscribed for the dependency The ready function will run on any containers which have all dependencies satisfied

func (*PubSub) Subscribe

func (p *PubSub) Subscribe(c *NodeContainer, id ID)

Subscribe will subscribe the given node container for the given dependency

func (*PubSub) Unsubscribe

func (p *PubSub) Unsubscribe(c *NodeContainer, id ID)

Unsubscribe will unsubscribe the given node container for the given dependency

type Result

type Result interface {
	Retryable
	RetryReason() string
}

Result is an interface for returning the result of a block run

func RetryAfter

func RetryAfter(duration time.Duration, reason string) Result

RetryAfter is a block run result which indicates we need to retry after the given time

type Retry

type Retry string

Retry is a block run result which indicates we need to retry

func (Retry) Retry

func (r Retry) Retry() bool

func (Retry) RetryAfter

func (r Retry) RetryAfter() time.Duration

func (Retry) RetryReason

func (r Retry) RetryReason() string

type RetryConfig

type RetryConfig struct {
	Limit int
}

type Retryable

type Retryable interface {
	Retry() bool
	RetryAfter() time.Duration
}

Retryable is a common interface for a retryable result or error

type RuntimeConfig

type RuntimeConfig struct {
	Skip        *bool
	Timeout     *time.Duration
	Triggers    []ID
	RetryConfig *RetryConfig
}

func (*RuntimeConfig) ApplyToRuntimeConfig

func (r *RuntimeConfig) ApplyToRuntimeConfig(r2 *RuntimeConfig)

func (*RuntimeConfig) IsTrigger

func (r *RuntimeConfig) IsTrigger(trigger ID) bool

type RuntimeConfigOption

type RuntimeConfigOption interface {
	ApplyToRuntimeConfig(*RuntimeConfig)
}

type UserContexter

type UserContexter interface {
	UserContext(ctx interface{}) interface{}
}

UserContexter defines an interface about creating a new user context

type VariableNode

type VariableNode interface {
	parsley.Node
	Identifiable
	ParentID() ID
	ParamName() ID
}

VariableNode stores a variable reference. It always refers to a named block's parameter.

type WaitGroup

type WaitGroup interface {
	Add(delta int)
	Wait() <-chan struct{}
	Done(err error)
	Err() error
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
job
jobfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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