wiring

package
v0.7.0-dev.2 Latest Latest
Warning

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

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

Documentation

Overview

Package wiring holds composition-root types that connect concrete implementations across the config, provider, scorer, search and embedded packages.

This package exists to break import cycles that would otherwise arise from defining wiring types (Func) in the shared types package alongside cross-cutting concerns. wiring/ depends on boundary packages without polluting either with the other's symbols.

wiring/ is imported by main.go (the composition root, which builds a Func over Build) and by server/ (which receives the Func via WithWire and calls it on each config reload). No other package should import wiring/.

wiring/ is also the home for cross-package compile-time assertions where neither side can hold the assertion without creating a cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extras added in v0.6.6

type Extras struct {
	SyncExec syncing.SyncExec
	Tracks   search.TrackDetector
	Media    *mediawrite.Writer
}

Extras are the process-lifetime collaborators shared by every engine Build creates, across reloads.

type Func

type Func func(
	ctx context.Context,
	cfg *config.Config,
	db search.Store,
	m search.Metrics,
) (Result, error)

Func creates the search engine, scorer, loaded providers and their gate binding from config. Called during Start and hot reload.

The engine and config are CONCRETE because both ends of this signature are composition roots: main.go supplies the func and internal/server holds the live *config.Config and calls it, so neither has anything to hide from the other.

type Result added in v0.6.6

type Result struct {
	Engine    *search.Engine
	Scorer    *scorer.Engine
	Binding   *providergate.Binding
	Providers []provider.Provider
}

Result is what one Func call builds. Binding is the gate's view of exactly the providers in Providers.

func Build added in v0.6.6

func Build(ctx context.Context, cfg *config.Config, db search.Store, m search.Metrics,
	reg *provider.Registry, gate *providergate.Gate, x Extras,
) (Result, error)

Build loads the enabled providers, binds the ones that loaded to gate under their normalized settings, and builds the engine over them. x.Media is required.

Jump to

Keyboard shortcuts

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