invokers

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BLANK string = ""
View Source
const MAIN_RESOURCE string = ":default-resource:"

Variables

This section is empty.

Functions

func ConvertSecondToDuration added in v1.0.6

func ConvertSecondToDuration(t TimeSecond) time.Duration

Types

type CommandDescriptor

type CommandDescriptor struct {
	CommandString    string     `json:"command"`
	ExecutionTimeout TimeSecond `json:"timeout"`
	// contains filtered or unexported fields
}

type CommandEntrypoint

type CommandEntrypoint struct {
	Enabled        *bool                         `json:"enabled"`
	Default        *CommandDescriptor            `json:"default"`
	Methods        map[string]*CommandDescriptor `json:"methods"`
	Pattern        *string                       `json:"pattern"`
	Settings       map[string]interface{}        `json:"settings"`
	SettingsFormat *string                       `json:"settings-format"`
	// contains filtered or unexported fields
}

type CommandInvocation

type CommandInvocation struct {
	Context          context.Context
	Envs             []string
	DirectCommand    string
	ResourceName     string
	MethodName       string
	RequestId        string
	ExecutionTimeout TimeSecond
}

type ExecutionState

type ExecutionState struct {
	IsTimeout bool
	Duration  time.Duration
}

type Executor

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

func NewExecutor

func NewExecutor(opts *ExecutorOptions) (e *Executor, err error)

func (*Executor) GetNewPipeChain added in v1.0.4

func (e *Executor) GetNewPipeChain() func(logger *loq.Logger) PipeChainRunner

func (*Executor) GetSettings added in v1.0.5

func (e *Executor) GetSettings(resourceName string) []string

func (*Executor) Register

func (e *Executor) Register(descriptor *CommandDescriptor, names ...string) error

func (*Executor) ResolveCommandDescriptor added in v1.0.5

func (e *Executor) ResolveCommandDescriptor(opts *CommandInvocation) (*CommandDescriptor, *string, *string, error)

func (*Executor) Run

func (e *Executor) Run(ib io.Reader, opts *CommandInvocation, ob io.Writer, eb io.Writer) (*ExecutionState, error)

func (*Executor) RunOnRawData

func (e *Executor) RunOnRawData(opts *CommandInvocation, inData []byte) ([]byte, []byte, *ExecutionState, error)

func (*Executor) StoreSettings added in v1.0.4

func (e *Executor) StoreSettings(prefix string, settings map[string]interface{}, format string, resourceName string) error

type ExecutorOptions

type ExecutorOptions struct {
	DefaultCommand *CommandDescriptor
	Logger         *loq.Logger
}

type PipeChain

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

func NewPipeChain added in v1.0.8

func NewPipeChain(logger *loq.Logger) *PipeChain

func (*PipeChain) Run

func (p *PipeChain) Run(ib io.Reader, ob io.Writer, eb io.Writer, chain ...*exec.Cmd) error

func (*PipeChain) Stop

func (p *PipeChain) Stop()

type PipeChainRunner added in v1.0.4

type PipeChainRunner interface {
	Run(ib io.Reader, ob io.Writer, eb io.Writer, chain ...*exec.Cmd) error
	Stop()
}

type TimeSecond added in v1.0.2

type TimeSecond float64

func ConvertDurationToSecond added in v1.0.6

func ConvertDurationToSecond(t time.Duration) TimeSecond

func GetExecutionTimeout added in v1.0.5

func GetExecutionTimeout(cd *CommandDescriptor, ci *CommandInvocation) TimeSecond

Jump to

Keyboard shortcuts

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