engine

package
v0.0.0-...-99b6f83 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheKeyManifestSchemaVersion = 1
	CacheKeyManifestMaxAge        = 15 * time.Minute
)

Variables

This section is empty.

Functions

func WriteCacheKeyManifest

func WriteCacheKeyManifest(path string, manifest *api.CacheKeyManifest) error

WriteCacheKeyManifest atomically writes a manifest with owner-only permissions. The manifest is intended for an immediate Run request using CacheKeyManifestPath, not for durable or cross-job cache storage.

Types

type CacheKeyManifestError

type CacheKeyManifestError struct {
	Reason     string
	DurationMs int64
}

func (*CacheKeyManifestError) Error

func (e *CacheKeyManifestError) Error() string

type Engine

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

func New

func New(p project.Project, worktree string) (*Engine, error)

func (*Engine) CacheKey

func (e *Engine) CacheKey(ctx context.Context, req Request) (*api.CacheKeyResult, error)

func (*Engine) CacheKeyWithManifest

func (e *Engine) CacheKeyWithManifest(ctx context.Context, req Request) (*api.CacheKeyResult, *api.CacheKeyManifest, error)

func (*Engine) Graph

func (e *Engine) Graph() *graph.Graph

func (*Engine) Run

func (e *Engine) Run(ctx context.Context, req Request) (*Outcome, error)

func (*Engine) SubscribeEvents

func (e *Engine) SubscribeEvents() <-chan api.Event

func (*Engine) SubscribeEventsLossless

func (e *Engine) SubscribeEventsLossless() <-chan api.Event

SubscribeEventsLossless returns a backpressured event subscription for consumers that must observe every event, such as direct CI progress output.

func (*Engine) Watch

func (e *Engine) Watch(ctx context.Context, req Request) error

type LifecycleController

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

LifecycleController serializes external stop and restart requests with the engine loop that owns the service handles. Calling handle.Stop from the daemon directly would make the engine interpret the expected exit as a crash and stop unrelated services.

func NewLifecycleController

func NewLifecycleController() *LifecycleController

func (*LifecycleController) Restart

func (*LifecycleController) Stop

type Outcome

type Outcome struct {
	Result   api.RunResult
	Instance *api.Instance
}

type Request

type Request struct {
	Target               string
	Worktree             string
	Mode                 api.RunMode
	MaxParallel          int
	CacheKeyManifestPath string
	LifecycleController  *LifecycleController
}

type ServiceIdentity

type ServiceIdentity struct {
	PID        int    `json:"pid,omitempty"`
	Generation uint64 `json:"generation"`
}

ServiceIdentity identifies one concrete service process. Generation remains useful for non-process ServiceHandle implementations whose PID is zero, and prevents a late Wait result from an old handle from being attributed to its replacement.

type ServiceLifecycleResult

type ServiceLifecycleResult struct {
	Task     string          `json:"task"`
	Action   string          `json:"action"`
	Previous ServiceIdentity `json:"previous"`
	Current  ServiceIdentity `json:"current"`
	Stopped  bool            `json:"stopped"`
	Ready    bool            `json:"ready"`
}

ServiceLifecycleResult describes the service process actually affected by a daemon lifecycle request.

Jump to

Keyboard shortcuts

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