executable_seq

package
Version: v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NagateMatcher

func NagateMatcher(m handler.Matcher) handler.Matcher

func ParseExecutableNode

func ParseExecutableNode(in interface{}, logger *zap.Logger) (handler.ExecutableChainNode, error)

ParseExecutableNode parses in into a ExecutableChainNode. in can be: (a / a slice of) Executable, (a / a slice of) string of registered handler.ExecutablePlugin tag, (a / a slice of) map[string]interface{}, which can be parsed to FallbackConfig, ParallelConfig or IfNodeConfig, a []interface{} that contains all of the above.

Types

type BatchMatherAnd

type BatchMatherAnd []handler.Matcher

func (BatchMatherAnd) Match

func (bm BatchMatherAnd) Match(ctx context.Context, qCtx *handler.Context) (bool, error)

type BatchMatherOr

type BatchMatherOr []handler.Matcher

func (BatchMatherOr) Match

func (bm BatchMatherOr) Match(ctx context.Context, qCtx *handler.Context) (bool, error)

type FallbackConfig

type FallbackConfig struct {
	// Primary exec sequence.
	Primary interface{} `yaml:"primary"`
	// Secondary exec sequence.
	Secondary interface{} `yaml:"secondary"`

	StatLength int `yaml:"stat_length"` // An Zero value disables the normal fallback.
	Threshold  int `yaml:"threshold"`

	// FastFallback threshold in milliseconds. Zero means fast fallback is disabled.
	FastFallback int `yaml:"fast_fallback"`

	// AlwaysStandby: secondary should always standby in fast fallback.
	AlwaysStandby bool `yaml:"always_standby"`
}

type FallbackNode

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

func ParseFallbackNode

func ParseFallbackNode(c *FallbackConfig, logger *zap.Logger) (*FallbackNode, error)

func (*FallbackNode) Exec

type IfNode

type IfNode struct {
	ConditionMatcher   handler.Matcher // if ConditionMatcher is nil, IfNode is a no-op.
	ExecutableNode     handler.ExecutableChainNode
	ElseExecutableNode handler.ExecutableChainNode
	// contains filtered or unexported fields
}

IfNode implement handler.ExecutableChainNode. Internal IfNode.ExecutableNode will also be linked by LinkPrevious and LinkNext.

func ParseIfChainNode

func ParseIfChainNode(c *IfNodeConfig, logger *zap.Logger) (*IfNode, error)

func (*IfNode) Exec

func (b *IfNode) Exec(ctx context.Context, qCtx *handler.Context, next handler.ExecutableChainNode) (err error)

func (*IfNode) LinkNext

func (b *IfNode) LinkNext(n handler.ExecutableChainNode)

func (*IfNode) LinkPrevious

func (b *IfNode) LinkPrevious(n handler.ExecutableChainNode)

func (*IfNode) Next

func (*IfNode) Previous

func (b *IfNode) Previous() handler.ExecutableChainNode

type IfNodeConfig

type IfNodeConfig struct {
	// Available type are:
	// 	1. string (a tag of registered handler.MatcherPlugin)
	// 	2. handler.Matcher.
	// 	3. a slice of interface{} and contains above type. (In this case, the logic
	// 		between multiple matchers is OR.)
	// Must specify one condition. If both conditions are given, If takes the priority.
	If    interface{} `yaml:"if"`     // logical OR
	IfAnd interface{} `yaml:"if_and"` // logical AND

	// See ParseExecutableNode.
	Exec     interface{} `yaml:"exec"`
	ElseExec interface{} `yaml:"else_exec"`
}

IfNodeConfig is a config to build a IfNode.

type LBConfig added in v2.2.0

type LBConfig struct {
	LoadBalance []interface{} `yaml:"load_balance"`
}

type LBNode added in v2.2.0

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

func ParseLBNode added in v2.2.0

func ParseLBNode(c *LBConfig, logger *zap.Logger) (*LBNode, error)

func (*LBNode) Exec added in v2.2.0

func (lbn *LBNode) Exec(ctx context.Context, qCtx *handler.Context, next handler.ExecutableChainNode) error

func (*LBNode) LinkNext added in v2.2.0

func (lbn *LBNode) LinkNext(n handler.ExecutableChainNode)

func (*LBNode) LinkPrevious added in v2.2.0

func (lbn *LBNode) LinkPrevious(n handler.ExecutableChainNode)

func (*LBNode) Next added in v2.2.0

func (lbn *LBNode) Next() handler.ExecutableChainNode

func (*LBNode) Previous added in v2.2.0

func (lbn *LBNode) Previous() handler.ExecutableChainNode

type NagativeMatcher

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

func (*NagativeMatcher) Match

func (n *NagativeMatcher) Match(ctx context.Context, qCtx *handler.Context) (matched bool, err error)

type ParallelConfig

type ParallelConfig struct {
	Parallel []interface{} `yaml:"parallel"`
	Timeout  uint          `yaml:"timeout"`
}

type ParallelNode

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

func ParseParallelNode

func ParseParallelNode(c *ParallelConfig, logger *zap.Logger) (*ParallelNode, error)

func (*ParallelNode) Exec

type RefExecPluginNode

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

RefExecPluginNode is a handler.ExecutablePlugin reference tag.

func NewREPNode

func NewREPNode(tag string) *RefExecPluginNode

NewREPNode creates a RefExecPluginNode from tag.

func (*RefExecPluginNode) Exec

type RefMatcherPluginNode

type RefMatcherPluginNode string

RefMatcherPluginNode is a handler.MatcherPlugin reference tag.

func (RefMatcherPluginNode) Match

func (ref RefMatcherPluginNode) Match(ctx context.Context, qCtx *handler.Context) (matched bool, err error)

Jump to

Keyboard shortcuts

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