core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk[T any](root Nodable[T], nextNodesCb func(parent, node Nodable[T]))

Types

type ChainedPipe

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

func (ChainedPipe) Pipe

func (cp ChainedPipe) Pipe(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

type Config

type Config struct{}

type EmptySecPlugin

type EmptySecPlugin struct {
}

func (EmptySecPlugin) Config

func (spp EmptySecPlugin) Config(config []byte) error

func (EmptySecPlugin) GetInputSchema

func (spp EmptySecPlugin) GetInputSchema() ([]byte, error)

func (EmptySecPlugin) Run

func (spp EmptySecPlugin) Run(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

type GoTemplateConfig

type GoTemplateConfig struct {
	Format  string `yaml:"format"`
	Pattern string `yaml:"pattern"`
}

type GoTemplateOption

type GoTemplateOption = helper.OptionError[goTemplatePipe]

func WithJsonInput

func WithJsonInput() GoTemplateOption

func WithTemplate

func WithTemplate(tmp *template.Template) GoTemplateOption

func WithTemplatePattern

func WithTemplatePattern(pattern string) GoTemplateOption

func WithYamlInput

func WithYamlInput() GoTemplateOption

type IndexableNode

type IndexableNode[T any] interface {
	BuildIndex()
	Query(query T)
}

type MutableNode

type MutableNode[T any] interface {
	Nodable[T]
	AddNode(node ...Nodable[T])
	DeleteNode(node ...string)
}

type Nodable

type Nodable[T any] interface {
	GetName() string
	GetChilds() Nodes[T]
	GetValue() T
}

type Node

type Node[T any] struct {
	Name  string                `yaml:"name" json:"name"`
	Nodes map[string]Nodable[T] `yaml:"nodes" json:"nodes"`
	Index NodeIndex
}

func (*Node[T]) AddNode

func (bn *Node[T]) AddNode(node ...Nodable[T])

func (*Node[T]) DeleteNode

func (bn *Node[T]) DeleteNode(node ...string)

func (Node[T]) GetChilds

func (bn Node[T]) GetChilds() Nodes[T]

func (Node[T]) GetName

func (bn Node[T]) GetName() string

type NodeIndex

type NodeIndex map[string]string

type Nodes

type Nodes[T any] map[string]Nodable[T]

type PipeFunc

type PipeFunc func(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

func (PipeFunc) Pipe

func (pf PipeFunc) Pipe(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

type Pipeable

type Pipeable interface {
	Pipe(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)
}

func NewBase64Decoder

func NewBase64Decoder() Pipeable

func NewChainedPipe

func NewChainedPipe(chain ...Pipeable) Pipeable

func NewEmptyPipe

func NewEmptyPipe() Pipeable

func NewGoTemplatePipe

func NewGoTemplatePipe[OPT GoTemplateOption](opt ...OPT) Pipeable

func NewGoTemplatePipeWithConfig

func NewGoTemplatePipeWithConfig(config GoTemplateConfig) Pipeable

func NewInsertStringPipe

func NewInsertStringPipe(insert string) Pipeable

func NewMapPipe

func NewMapPipe(mapper func(elem *pluginctl.DataStream) *pluginctl.DataStream) Pipeable

func NewRegexpPipe

func NewRegexpPipe(regexpPattern string, n int) Pipeable

func NewSplitPipe

func NewSplitPipe(sep string) Pipeable

func NewWorkerPipe

func NewWorkerPipe(worker func(elem *pluginctl.DataStream, c chan<- *pluginctl.DataStream)) Pipeable

type PluginPipe

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

func (PluginPipe) Pipe

func (dc PluginPipe) Pipe(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

type SecGraph

type SecGraph = graph.Graph[string, SecVertex]

type SecPipePlugin

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

func (SecPipePlugin) Config

func (spp SecPipePlugin) Config(config []byte) error

func (SecPipePlugin) GetInputSchema

func (spp SecPipePlugin) GetInputSchema() ([]byte, error)

func (SecPipePlugin) Run

func (spp SecPipePlugin) Run(ctx context.Context, input <-chan *pluginctl.DataStream) (<-chan *pluginctl.DataStream, <-chan error)

type SecVertex

type SecVertex struct {
	Name string
	// contains filtered or unexported fields
}

type Stage

type Stage struct {
	Parents    []string               `yaml:"parents"`
	PluginPath string                 `yaml:"pluginPath"`
	Plugin     string                 `yaml:"plugin"`
	Config     map[string]any         `yaml:"config"`
	Pipe       []map[string]yaml.Node `yaml:"pipe"`
}

func (Stage) AddEdges

func (st Stage) AddEdges(g SecGraph, name string, rootVertex SecVertex) error

func (Stage) AddSecVertex

func (st Stage) AddSecVertex(g SecGraph, name string) error

func (Stage) GetSecVertex

func (st Stage) GetSecVertex(name string) (SecVertex, error)

type Template

type Template struct {
	Name        string           `yaml:"name" json:"name"`
	Description string           `yaml:"description" json:"description"`
	Version     string           `yaml:"version" json:"version"`
	Author      string           `yaml:"author" json:"author"`
	Stages      map[string]Stage `yaml:"stages" json:"stages"`
}

func NewFileTemplate

func NewFileTemplate(path string) (Template, error)

func NewRawTemplate

func NewRawTemplate(raw []byte) (Template, error)

func (*Template) DrawGraphOnly

func (t *Template) DrawGraphOnly(filepath string) error

func (Template) Raw

func (t Template) Raw() ([]byte, error)

func (Template) Start

func (t Template) Start(ctx context.Context) (error, <-chan error)

Jump to

Keyboard shortcuts

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