runmanager

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package runmanager owns in-process pipeline execution for the server: it triggers runs (each engine.Run on its own goroutine + bus), tracks active runs so they can be cancelled, and fans their live events out to SSE subscribers. Persistence (store + event log) is wired in as sinks, so a server-triggered run is recorded exactly like a CLI run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager triggers, tracks and cancels runs.

func New

func New(st *store.Store) *Manager

func (*Manager) Active

func (m *Manager) Active(runID string) bool

Active reports whether a run is currently executing.

func (*Manager) Cancel

func (m *Manager) Cancel(runID string) bool

Cancel cancels an active run. It returns false if the run is unknown or has already finished.

func (*Manager) SetRunFunc

func (m *Manager) SetRunFunc(fn RunFunc)

SetRunFunc overrides the executor (tests).

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context)

Shutdown cancels every active run (so the engine runs container cleanup and SSE streams unblock) and waits for them to clear, or until ctx expires. It is called on server shutdown.

func (*Manager) Subscribe

func (m *Manager) Subscribe(runID string) (<-chan engine.Event, func(), bool)

Subscribe returns a live event channel and unsubscribe func for an active run, or ok=false if the run is not currently running (callers then replay from the event log instead).

func (*Manager) Trigger

func (m *Manager) Trigger(spec engine.Spec) (string, error)

Trigger starts a run for spec and returns its id immediately. The run executes on its own goroutine; its context is owned by the manager (not any HTTP request) so it outlives the trigger call and is cancellable via Cancel.

type RunFunc

type RunFunc func(ctx context.Context, runID string, spec engine.Spec, bus *engine.Bus) error

RunFunc executes a run. It matches engine.Run and is injectable so tests can drive the manager without a Docker daemon.

Jump to

Keyboard shortcuts

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