cte

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPlanExecutionEndingEarly can be thrown actively by clients to end plan execution early.
	// For example, a value was retrieved from cache and thus, there's no point executing the algo
	// to calculate this value anymore. The engine will swallow this error, end execution and then
	// return a nil error to clients.
	//
	// Note: If the ending plan is nested inside another plan, the outer plan will still continue
	// as usual.
	ErrPlanExecutionEndingEarly = errors.New("plan execution ending early")
	// ErrRootPlanExecutionEndingEarly can be thrown actively by clients to end plan execution
	// early. For example, a value was retrieved from cache and thus, there's no point executing
	// the algo to calculate this value anymore. The engine will swallow this error, end execution
	// and then return a nil error to clients.
	//
	// Note: If the ending plan is nested inside another plan, the outer plan will also end.
	ErrRootPlanExecutionEndingEarly = errors.New("plan execution ending early from root")

	ErrPlanMustUsePointerReceiver = makeFormatErr("%v is using value receiver, all plans must be implemented using pointer receiver")
	ErrPlanNotAnalyzed            = makeFormatErr("%v has not been analyzed yet, call AnalyzePlan on it first")
	ErrNestedPlanCannotBePointer  = makeFormatErr("%v has a nested plan called %v that is a pointer")

	ErrPlanNotMeetingInoutRequirements            = makeFormatErr("%v does not implement the required in-out interface %v, problem found: %v. Component having problem: %v")
	ErrPlanMissingMethod                          = makeFormatErr("missing method: [%v]")
	ErrPlanHavingAmbiguousMethods                 = makeFormatErr("required method: [%v], found ambiguous methods: [%v], components carrying the ambiguous methods: [%v]")
	ErrPlanHavingSameMethodRegisteredMoreThanOnce = makeFormatErr("required method provided more than once by the same computer key: [%v], computer key locations: [%v]")
	ErrPlanHavingMethodButSignatureMismatched     = makeFormatErr("required method: [%v], found method with mismatched signature: [%v]")

	ErrInvalidComputerType = makeFormatErr("%v is not a computer")
	ErrMetadataMissing     = makeFormatErr("metadata is missing for %v, it must implement the MetadataProvider interface")
	ErrNilMetadata         = makeFormatErr("metadata is nil for %v")
	ErrComputerMetaMissing = makeFormatErr("computer meta is missing in %v")
	ErrInoutMetaMissing    = makeFormatErr("inout meta is missing in %v")
)

Functions

This section is empty.

Types

type Engine

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

func NewEngine

func NewEngine() Engine

func (Engine) AnalyzePlan

func (e Engine) AnalyzePlan(p Plan)

func (Engine) ExecuteMasterPlan

func (e Engine) ExecuteMasterPlan(ctx context.Context, p MasterPlan) error

func (Engine) VerifyConfigurations

func (e Engine) VerifyConfigurations() error

type ImpureComputer

type ImpureComputer interface {
	Compute(ctx context.Context, p MasterPlan) (interface{}, error)
}

type ImpureComputerWithLoadingData

type ImpureComputerWithLoadingData interface {
	LoadingComputer
	Compute(ctx context.Context, p MasterPlan, data LoadingData) (interface{}, error)
}

type LoadingComputer

type LoadingComputer interface {
	Load(ctx context.Context, p MasterPlan) (interface{}, error)
}

type LoadingData

type LoadingData struct {
	Data interface{}
	Err  error
}

type MasterPlan

type MasterPlan interface {
	Plan
	Execute(ctx context.Context) error
}

type MetadataProvider

type MetadataProvider interface {
	CTEMetadata() interface{}
}

type Plan

type Plan interface {
	IsSequentialCTEPlan() bool
}

type Post

type Post interface {
	PostExecute(p Plan) error
}

type Pre

type Pre interface {
	PreExecute(p Plan) error
}

type Result

type Result struct {
	Task async.Task
}

type SideEffect

type SideEffect struct{}

type SideEffectComputer

type SideEffectComputer interface {
	Compute(ctx context.Context, p MasterPlan) error
}

type SideEffectComputerWithLoadingData

type SideEffectComputerWithLoadingData interface {
	LoadingComputer
	Compute(ctx context.Context, p MasterPlan, data LoadingData) error
}

type SwitchComputer

type SwitchComputer interface {
	Switch(ctx context.Context, p MasterPlan) (MasterPlan, error)
}

type SwitchComputerWithLoadingData

type SwitchComputerWithLoadingData interface {
	LoadingComputer
	Switch(ctx context.Context, p MasterPlan, data LoadingData) (MasterPlan, error)
}

type SyncResult

type SyncResult struct {
	Outcome interface{}
}

type SyncSideEffect

type SyncSideEffect struct{}

Jump to

Keyboard shortcuts

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