steps

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingClientAPIKey = errors.Newf("missing client settings api key")
View Source
var ErrMissingClientSettings = errors.Newf("missing client settings")

Functions

This section is empty.

Types

type GenericStepFactory

type GenericStepFactory interface {
	// TODO(manuel, 2023-02-27) This is probably updateFromLayers, and each factory should be able to register its own layers
	UpdateFromParameters(ps map[string]interface{}) error
}

type PipeStep

type PipeStep[A, B, C any] struct {
	// contains filtered or unexported fields
}

func (*PipeStep[A, B, C]) GetOutput

func (s *PipeStep[A, B, C]) GetOutput() <-chan helpers.Result[C]

func (*PipeStep[A, B, C]) GetState

func (s *PipeStep[A, B, C]) GetState() interface{}

func (*PipeStep[A, B, C]) IsFinished

func (s *PipeStep[A, B, C]) IsFinished() bool

func (*PipeStep[A, B, C]) Run

func (s *PipeStep[A, B, C]) Run(ctx context.Context, a A) error

type PipeStepState

type PipeStepState int
const (
	PipeStepNotStarted   PipeStepState = iota
	PipeStepRunningStep1               // step 1 is running
	PipeStepRunningStep2               // step 2 is running
	PipeStepFinished
	PipeStepError
	PipeStepClosed
)

type SimpleStep

type SimpleStep[A, B any] struct {
	// contains filtered or unexported fields
}

func (*SimpleStep[A, B]) GetOutput

func (s *SimpleStep[A, B]) GetOutput() <-chan helpers.Result[B]

func (*SimpleStep[A, B]) GetState

func (s *SimpleStep[A, B]) GetState() interface{}

func (*SimpleStep[A, B]) IsFinished

func (s *SimpleStep[A, B]) IsFinished() bool

func (*SimpleStep[A, B]) Run

func (s *SimpleStep[A, B]) Run(_ context.Context, a A) error

type SimpleStepState

type SimpleStepState int
const (
	SimpleStepNotStarted SimpleStepState = iota
	SimpleStepRunning
	SimpleStepFinished
	SimpleStepClosed
)

type Step

type Step[A, B any] interface {
	// Run starts the step and blocks until the end
	Run(ctx context.Context, a A) error
	GetOutput() <-chan helpers.Result[B]
	GetState() interface{}
	IsFinished() bool
}

Step represents one step in a generic pipeline

func NewPipeStep

func NewPipeStep[A, B, C any](step1 Step[A, B], step2 Step[B, C]) Step[A, C]

func NewSimpleStep

func NewSimpleStep[A any, B any](f func(A) B) Step[A, B]

type StepDescription

type StepDescription struct {
	Type string `yaml:"type"`

	// TODO(manuel, 2023-02-04) This is all just a hack right now to get a sense of what we can
	// achieve in a YAML, and also just to get article.yaml working
	//
	// MultiInput is just the name of the input parameter used to iterate over the prompt
	MultiInput string `yaml:"multi_input,omitempty"`
}

type StepFactory

type StepFactory[A, B any] interface {
	NewStep() (Step[A, B], error)
}

type TemplateStep

type TemplateStep[A any] struct {
	// contains filtered or unexported fields
}

func NewTemplateStep

func NewTemplateStep[A any](template string) *TemplateStep[A]

func (*TemplateStep[A]) GetOutput

func (t *TemplateStep[A]) GetOutput() <-chan helpers.Result[string]

func (*TemplateStep[A]) GetState

func (t *TemplateStep[A]) GetState() interface{}

func (*TemplateStep[A]) IsFinished

func (t *TemplateStep[A]) IsFinished() bool

func (*TemplateStep[A]) Run

func (t *TemplateStep[A]) Run(ctx context.Context, a A) error

type TemplateStepState

type TemplateStepState int
const (
	TemplateStepNotStarted TemplateStepState = iota
	TemplateStepRunning
	TemplateStepFinished
	TemplateStepClosed
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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