wiring

package
v0.5.21 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 7 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 import-only by main.go (the composition root) and server/ (which receives a Func via WithWire and calls it on each config reload). No package other than these two should import wiring/.

wiring/ is also a convenient home for cross-package compile-time assertions where neither side can hold the assertion without creating a cycle (e.g. embedded.Detector satisfies search.TrackDetector, but search/ can't import embedded/ and embedded/ shouldn't import search/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

Func creates the search engine, scorer, and loaded providers from config. Called during Start and hot reload. The context allows cancellation of provider initialization (e.g. network calls during provider setup).

The engine is returned CONCRETE. This is the composition root's signature, and a root is the one place that is entitled to know the implementation: the consumers it feeds each declare the two or three engine methods they call (scanning.ScanEngine, and the unexported ones in polling, manualops and queryhandlers), so widening it back into a single eight-method interface here would only re-create the hub those declarations replaced.

The config is taken CONCRETE for the mirror-image reason. Both ends of this signature are composition roots — main.go supplies the func, internal/server holds the live *config.Config and calls it — so neither end has anything to hide from the other. What the wiring reads (Providers, Scores, Sync) plus what it hands to search.WithConfig (Cfg's 9) is 12 of the type's 37 methods, but a wiring-owned interface stating those 12 would be a THIRD name for a surface search already declares and config already implements.

Jump to

Keyboard shortcuts

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