engine

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 73 Imported by: 0

README

Engine Design Doc

Engine is primarily a for loop that takes inputs from a variety of sources, updates state, and makes a decision based off of that state. The rough shape of the for loop is as follows:

state := &state{}
for {
    select {
        // sources like local filesystem, kubernetes, ui, etc
        case ev := <- fsCh:
            e.handleFsEvent(ev)
        case ev := <- k8sCh:
            e.handleK8sEvent(ev)
    }
    // decide what to do: start a pipeline, stop a pipeline
    actions := handle(state)
    // tell subscribers what we took
    updateSubscribers(actions, state.copy())
}

When state changes, and only when state changes, can we make decisions about what to do. Only after actions have been taken do we tell subscribers.

Rules

  • No blocking I/O in the for loop
  • No long operations in the for loop
  • Actions taken in handle shouldn’t directly send to channels that this for selects on.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeployerWireSet = wire.NewSet(
	DeployerBaseWireSet,
)
View Source
var UpperReducer = store.Reducer(upperReducerFn)

Functions

func NewErrorAction

func NewErrorAction(err error) store.ErrorAction

func ProvideSubscribersAPIOnly added in v0.19.0

Subscribers that only read from the new Tilt API, and run the API server.

func SpanIDForBuildLog added in v0.10.24

func SpanIDForBuildLog(buildCount int) logstore.SpanID

Types

type BuildController

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

func (*BuildController) DisableForTesting added in v0.1.0

func (c *BuildController) DisableForTesting()

func (*BuildController) OnChange

func (c *BuildController) OnChange(ctx context.Context, st store.RStore, summary store.ChangeSummary) error

type CompositeBuildAndDeployer

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

CompositeBuildAndDeployer tries to run each builder in order. If a builder emits an error, it uses the FallbackTester to determine whether the error is critical enough to stop the whole pipeline, or to fallback to the next builder.

func NewCompositeBuildAndDeployer

func NewCompositeBuildAndDeployer(builders BuildOrder, tracer trace.Tracer) *CompositeBuildAndDeployer

func (*CompositeBuildAndDeployer) BuildAndDeploy

func (composite *CompositeBuildAndDeployer) BuildAndDeploy(ctx context.Context, st store.RStore, specs []model.TargetSpec, currentState store.BuildStateSet) (store.BuildResultSet, error)

type FallbackTester

type FallbackTester func(error) bool

type HudStoppedAction added in v0.1.0

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

func NewHudStoppedAction added in v0.1.0

func NewHudStoppedAction(err error) HudStoppedAction

func (HudStoppedAction) Action added in v0.1.0

func (HudStoppedAction) Action()

type InitAction

type InitAction struct {
	TiltfilePath string
	ConfigFiles  []string
	UserArgs     []string

	TiltBuild model.TiltBuild
	StartTime time.Time

	AnalyticsUserOpt analytics.Opt

	CloudAddress string
	Token        token.Token
	TerminalMode store.TerminalMode
}

func (InitAction) Action

func (InitAction) Action()

type ManifestReloadedAction

type ManifestReloadedAction struct {
	OldManifest model.Manifest
	NewManifest model.Manifest
	Error       error
}

func (ManifestReloadedAction) Action

func (ManifestReloadedAction) Action()

type PodWatcherMaker

type PodWatcherMaker func(context.Context, *store.Store) error

type ServiceWatcherMaker

type ServiceWatcherMaker func(context.Context, *store.Store) error

type TelemetryScriptRanAction added in v0.10.25

type TelemetryScriptRanAction struct {
	At time.Time
}

func (TelemetryScriptRanAction) Action added in v0.10.25

func (TelemetryScriptRanAction) Action()

type UIDUpdateAction added in v0.8.9

type UIDUpdateAction struct {
	UID          types.UID
	EventType    watch.EventType
	ManifestName model.ManifestName
	Entity       k8s.K8sEntity
}

func (UIDUpdateAction) Action added in v0.8.9

func (UIDUpdateAction) Action()

type Upper

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

TODO(nick): maybe this should be called 'BuildEngine' or something? Upper seems like a poor and undescriptive name.

func NewUpper

func NewUpper(ctx context.Context, st *store.Store, subs []store.Subscriber) (Upper, error)

func (Upper) Dispatch added in v0.1.0

func (u Upper) Dispatch(action store.Action)

func (Upper) Init added in v0.4.1

func (u Upper) Init(ctx context.Context, action InitAction) error

func (Upper) Start added in v0.1.0

func (u Upper) Start(
	ctx context.Context,
	args []string,
	b model.TiltBuild,
	fileName string,
	initTerminalMode store.TerminalMode,
	analyticsUserOpt analytics.Opt,
	token token.Token,
	cloudAddress string,
) error

Directories

Path Synopsis
Package analytics handles reporting of anonymized usage statistics about what features of Tilt are in use.
Package analytics handles reporting of anonymized usage statistics about what features of Tilt are in use.

Jump to

Keyboard shortcuts

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