scriptwiring

package
v1.134.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package scriptwiring assembles the managed-script feature: the execution handle the lifecycle starts, and the tool layer that authors and enqueues onto it.

It is a seam rather than a method on the facade for the reason every other composition seam here is one, and the reason its own construction comment already gave: composition is not behavior the facade should own, and the facade is at its size budget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wire

func Wire(deps Deps) *scriptexec.Handle

Wire assembles the managed-script feature and returns its execution handle for the lifecycle to start and stop. The handle also owns the schedule materializer, which runs wherever the run worker does.

The two halves are wired together here because only one of them can exist without the other: the tool layer registers manage_script on any database deployment, while run_script appears only where there is a queue to enqueue onto, so a deployment that cannot execute scripts still authors them and says plainly that nothing will run them.

The handle is built whether or not this replica runs the worker: the serving half of a split deployment still owns the queue it enqueues onto.

Wire builds both halves and registers the tool layer, returning the handle.

Types

type Deps

type Deps struct {
	DB     *sql.DB
	DSN    string
	Server *mcp.Server

	Assets       portal.AssetStore
	Versions     portal.VersionStore
	S3           portal.S3Client
	Bucket       string
	Prefix       string
	FollowTables func(ctx context.Context, assetID string, version int) []string
	Lander       *resourcewrite.Ref

	Audit    middleware.AuditLogger
	Subjects scriptexec.SubjectResolver
	Metrics  *observability.Metrics

	Destinations         []script.Destination
	RunRetention         time.Duration
	WorkerEnabled        bool
	NotificationsEnabled bool
	DigestHourUTC        int
	PortalURL            string
	AdminPersona         string
	Toolkits             *registry.Registry

	// Bind hands the assembled tool layer back to the facade, which keeps it
	// because the index queue binds its write-path producer (#1370).
	Bind func(*scriptlayer.Handle)
}

Deps are what the facade hands over: values it already holds, and one callback for the handle it keeps.

Jump to

Keyboard shortcuts

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