tmplexec

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 13 Imported by: 2

README

tmplexec

tmplexec also known as template executer executes template it is different from protocols package which only contains logic within the scope of one protocol. tmplexec is resposible for executing Template with defined logic. with introduction of multi protocol and flow templates (deprecated package protocols/common/executer) did not seem appropriate/helpful anymore as it is outside of protocol scope and deals with execution of template which can contain 1 requests , or multiple requests of same protocol or multiple requests of different protocols. tmplexec is responsible for executing template and handling all logic related to it.

Engine/Backends

Currently there are 3 engines for template execution

  • Generic => executes request[s] of same/one protocol
  • MultiProtocol => executes requests of multiple protocols with shared logic between protocol requests see multiprotocol
  • Flow => executes requests of one or multiple protocol requests as specified by template in javascript (aka flow) flow

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TemplateEngine

type TemplateEngine interface {
	// Note: below methods only need to implement extra / engine specific functionality
	// basic request compilation , callbacks , cli output callback etc are handled by `TemplateExecuter` and no need to do it again
	// Extra Compilation (if any)
	Compile() error

	// ExecuteWithResults executes the template and returns results
	ExecuteWithResults(input *contextargs.Context, callback protocols.OutputEventCallback) error

	// Name returns name of template engine
	Name() string
}

TemplateEngine is a template executor with different functionality Ex: 1. generic => executes all protocol requests one after another (Done) 2. flow => executes protocol requests based on how they are defined in flow (Done) 3. multiprotocol => executes multiple protocols in parallel (Done)

type TemplateExecuter

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

TemplateExecutor is an executor for a template

func NewTemplateExecuter

func NewTemplateExecuter(requests []protocols.Request, options *protocols.ExecutorOptions) *TemplateExecuter

NewTemplateExecuter creates a new request TemplateExecuter for list of requests

func (*TemplateExecuter) Compile

func (e *TemplateExecuter) Compile() error

Compile compiles the execution generators preparing any requests possible.

func (*TemplateExecuter) Execute

func (e *TemplateExecuter) Execute(input *contextargs.Context) (bool, error)

Execute executes the protocol group and returns true or false if results were found.

func (*TemplateExecuter) ExecuteWithResults

func (e *TemplateExecuter) ExecuteWithResults(input *contextargs.Context, callback protocols.OutputEventCallback) error

ExecuteWithResults executes the protocol requests and returns results instead of writing them.

func (*TemplateExecuter) Requests

func (e *TemplateExecuter) Requests() int

Requests returns the total number of requests the rule will perform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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