pluginhost

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pluginhost evaluates persistent render plugins using bounded, synchronous desired-inventory sweeps. It never exposes an incomplete inventory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

Host serializes evaluations and retains each lazily started process until Close.

func New

func New(commands []plugin.Command) (*Host, error)

New constructs a host without starting any processes.

func NewWithOptions

func NewWithOptions(commands []plugin.Command, options Options) (*Host, error)

NewWithOptions constructs a host with explicit trusted root producers and bounds.

func NewWithStarter

func NewWithStarter(commands []plugin.Command, start Starter) (*Host, error)

NewWithStarter supports deterministic in-process engines and custom transports.

func (*Host) Close

func (h *Host) Close() error

Close releases all started processes. It is idempotent and waits for any active render, including its session cleanup, to finish.

func (*Host) Render

func (h *Host) Render(ctx context.Context, request plugin.OpenRequest) (result *Result, err error)

Render opens fresh sessions, computes a fixed point, and closes every opened session before returning. RPC, validation, timeout, or cleanup failures return an error and Complete=false with no resources. Stable engine errors likewise suppress resources, but are represented by diagnostics rather than a Go error. request.Config is a JSON object keyed by command name; each engine's object overrides matching top-level keys in that command's Config. An operation error retires every engine after session cleanup. A subsequent Render starts fresh processes; uncertain RPCs are never retried in this render.

type Options

type Options struct {
	Start Starter
	// RootPlugins approves additional root-producing command names. Flux is always trusted.
	RootPlugins   []string
	MaxIterations int           // Defaults to 64, and cannot exceed 64.
	Timeout       time.Duration // Defaults to five minutes, including startup and sweeps.
}

Options configures trusted startup policy, not resource-derived instructions.

type Result

type Result struct {
	Resources   []plugin.Resource
	Diagnostics []plugin.Diagnostic
	Evidence    []json.RawMessage
	Complete    bool
}

Result contains only a converged inventory. Diagnostics and evidence describe the last accepted sweep; evidence is never supplied to an engine as inventory.

type Starter

type Starter func(context.Context, plugin.Command) (plugin.Service, func() error, error)

Starter starts a persistent service and returns its process cleanup function. A nil cleanup is permitted for in-process services. Services must honor context cancellation and must not retain or mutate request or response values.

Jump to

Keyboard shortcuts

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