Documentation
¶
Overview ¶
Package runloop executes the dev-server watcher event loop.
It owns the deterministic ordering of hooks, builds, restarts, and browser notifications so caller code does not orchestrate these steps ad hoc.
Index ¶
- type Dependencies
- type Engine
- func (engine *Engine) ContinuePipelineAfterHookStageOrTriggerRestart(hookStageResult hooks.HookStageResult) bool
- func (engine *Engine) ContinuePipelineAfterHookStageOrTriggerRestartWithFailurePolicy(hookStageResult hooks.HookStageResult, ...) bool
- func (engine *Engine) ExecuteAppStopStrategy(appStopStrategy eventpipeline.AppStopStrategy)
- func (engine *Engine) ExecuteEventExecutionPlan(eventsWithHooks []eventpipeline.EventWithHooks, ...)
- func (engine *Engine) ExecuteHookExecutionPlanWithContext(parentHookExecutionContext context.Context, stageType hooks.HookStageType, ...) (*wavewatch.RefreshAction, error)
- func (engine *Engine) FireNoWaitHooks(eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher)
- func (engine *Engine) FireNoWaitHooksForEvents(eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher)
- func (engine *Engine) ProcessEvents(events []fsnotify.Event)
- func (engine *Engine) ProcessEventsWithDeterministicPipeline(behavioralDecision eventpipeline.EventExecutionPlanBehavioralDecision, ...)
- func (engine *Engine) RunConcurrentHooksForEventsWithContextAndErrors(concurrentHookExecutionContext context.Context, ...) ([]wavewatch.RefreshAction, []error)
- func (engine *Engine) RunConcurrentHooksWithContext(concurrentHookExecutionContext context.Context, ...) ([]wavewatch.RefreshAction, error)
- func (engine *Engine) RunPostHooks(eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher) ([]wavewatch.RefreshAction, error)
- func (engine *Engine) RunPostHooksForEventsWithErrors(eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher) ([]wavewatch.RefreshAction, []error)
- func (engine *Engine) RunPreHooks(eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher) ([]wavewatch.RefreshAction, error)
- func (engine *Engine) RunPreHooksForEventsWithErrors(eventsWithHooks []eventpipeline.EventWithHooks, work *eventpipeline.WorkSet, ...) ([]wavewatch.RefreshAction, []error)
- func (engine *Engine) RunSequentialHookStageForEligibleEventsWithErrors(eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher, ...) ([]wavewatch.RefreshAction, []error)
- func (engine *Engine) RunWatcherWithContext(watcherExecutionContext context.Context)
- func (engine *Engine) TriggerRestartFromRefreshActions(actionResult eventpipeline.RefreshActionApplicationResult)
- type WatcherExecutionTraceContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct {
Log *slog.Logger
Config *waveconfig.ParsedConfig
GetCurrentWatcher func() *watch.Watcher
GetCurrentBuilder func() *builder.Builder
CurrentRunCycleContextOrBackground func() context.Context
ExecuteBuildPhase func(*eventpipeline.WorkSet) error
ExecuteBrowserPhase func(*eventpipeline.WorkSet)
StartApp func()
StopApp func() error
TriggerRestart func()
TriggerRestartNoGo func()
TriggerConfigRestart func()
BroadcastRebuilding func()
BuildEventExecutionPlan func(
events []fsnotify.Event,
watcher *watch.Watcher,
builder *builder.Builder,
) eventpipeline.EventExecutionPlanningResult
DeriveWatcherExecutionTraceContext func() WatcherExecutionTraceContext
SetCurrentWatcherExecutionTraceContext func(WatcherExecutionTraceContext)
ClearCurrentWatcherExecutionTraceContext func()
GetCurrentWatcherExecutionTraceContext func() WatcherExecutionTraceContext
RunNoWaitHookWithConcurrencyLimit func(func())
GetOrCreateConcurrentNoWaitHookLifecycleContext func() context.Context
ResolveHookExecutionPlan func(wavewatch.OnChangeHook) hooks.HookExecutionPlan
IsWaitingForBuildRetry func() bool
}
Dependencies defines orchestration callbacks required by Engine.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine owns deterministic watcher batch processing and hook/build orchestration.
func (*Engine) ContinuePipelineAfterHookStageOrTriggerRestart ¶
func (engine *Engine) ContinuePipelineAfterHookStageOrTriggerRestart( hookStageResult hooks.HookStageResult, ) bool
ContinuePipelineAfterHookStageOrTriggerRestart resolves continuation with configured policy.
func (*Engine) ContinuePipelineAfterHookStageOrTriggerRestartWithFailurePolicy ¶
func (engine *Engine) ContinuePipelineAfterHookStageOrTriggerRestartWithFailurePolicy( hookStageResult hooks.HookStageResult, hookStageFailurePolicy hooks.HookStageFailurePolicy, ) bool
ContinuePipelineAfterHookStageOrTriggerRestartWithFailurePolicy resolves continuation decision.
func (*Engine) ExecuteAppStopStrategy ¶
func (engine *Engine) ExecuteAppStopStrategy( appStopStrategy eventpipeline.AppStopStrategy, )
ExecuteAppStopStrategy applies stop strategy for current batch.
func (*Engine) ExecuteEventExecutionPlan ¶
func (engine *Engine) ExecuteEventExecutionPlan( eventsWithHooks []eventpipeline.EventWithHooks, behavioralDecision eventpipeline.EventExecutionPlanBehavioralDecision, work *eventpipeline.WorkSet, watcher *watch.Watcher, )
ExecuteEventExecutionPlan applies stop strategy and deterministic pipeline for a batch.
func (*Engine) ExecuteHookExecutionPlanWithContext ¶
func (engine *Engine) ExecuteHookExecutionPlanWithContext( parentHookExecutionContext context.Context, stageType hooks.HookStageType, executionPlan hooks.HookExecutionPlan, hookContext *wavewatch.HookContext, ) (*wavewatch.RefreshAction, error)
ExecuteHookExecutionPlanWithContext executes callback and command portions of one plan.
func (*Engine) FireNoWaitHooks ¶
func (engine *Engine) FireNoWaitHooks( eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher, )
FireNoWaitHooks executes detached concurrent-no-wait hook plans for one event.
func (*Engine) FireNoWaitHooksForEvents ¶
func (engine *Engine) FireNoWaitHooksForEvents( eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher, )
FireNoWaitHooksForEvents starts concurrent-no-wait hooks for all eligible events.
func (*Engine) ProcessEvents ¶
ProcessEvents evaluates one debounced watcher batch and executes deterministic pipeline.
func (*Engine) ProcessEventsWithDeterministicPipeline ¶
func (engine *Engine) ProcessEventsWithDeterministicPipeline( behavioralDecision eventpipeline.EventExecutionPlanBehavioralDecision, work *eventpipeline.WorkSet, watcher *watch.Watcher, eventsWithHooks []eventpipeline.EventWithHooks, )
ProcessEventsWithDeterministicPipeline runs hooks/build/browser in fixed order.
func (*Engine) RunConcurrentHooksForEventsWithContextAndErrors ¶
func (engine *Engine) RunConcurrentHooksForEventsWithContextAndErrors( concurrentHookExecutionContext context.Context, eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, []error)
RunConcurrentHooksForEventsWithContextAndErrors executes concurrent hooks and preserves event order.
func (*Engine) RunConcurrentHooksWithContext ¶
func (engine *Engine) RunConcurrentHooksWithContext( concurrentHookExecutionContext context.Context, eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, error)
RunConcurrentHooksWithContext executes concurrent hooks for one event.
func (*Engine) RunPostHooks ¶
func (engine *Engine) RunPostHooks( eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, error)
RunPostHooks executes post hook plans for one event.
func (*Engine) RunPostHooksForEventsWithErrors ¶
func (engine *Engine) RunPostHooksForEventsWithErrors( eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, []error)
RunPostHooksForEventsWithErrors executes post hooks for all events.
func (*Engine) RunPreHooks ¶
func (engine *Engine) RunPreHooks( eventWithHooks eventpipeline.EventWithHooks, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, error)
RunPreHooks executes pre hook plans for one event.
func (*Engine) RunPreHooksForEventsWithErrors ¶
func (engine *Engine) RunPreHooksForEventsWithErrors( eventsWithHooks []eventpipeline.EventWithHooks, work *eventpipeline.WorkSet, watcher *watch.Watcher, ) ([]wavewatch.RefreshAction, []error)
RunPreHooksForEventsWithErrors executes pre hooks for all events.
func (*Engine) RunSequentialHookStageForEligibleEventsWithErrors ¶
func (engine *Engine) RunSequentialHookStageForEligibleEventsWithErrors( eventsWithHooks []eventpipeline.EventWithHooks, watcher *watch.Watcher, runHooksForEvent func(eventpipeline.EventWithHooks, *watch.Watcher) ([]wavewatch.RefreshAction, error), hookExecutionFailureLogMessage string, ) ([]wavewatch.RefreshAction, []error)
RunSequentialHookStageForEligibleEventsWithErrors executes one stage in event order.
func (*Engine) RunWatcherWithContext ¶
RunWatcherWithContext consumes watcher events until cancellation or watcher closure.
func (*Engine) TriggerRestartFromRefreshActions ¶
func (engine *Engine) TriggerRestartFromRefreshActions( actionResult eventpipeline.RefreshActionApplicationResult, )
TriggerRestartFromRefreshActions triggers restart side effects from action result.
type WatcherExecutionTraceContext ¶
WatcherExecutionTraceContext carries watcher-cycle and batch identifiers.