app

package
v0.10.0-dev.73 Latest Latest
Warning

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

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

Documentation

Overview

Package app is subflux's composition root: the one boot path, the supervision of every long-running component, and the drain.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPaths = Paths{Config: "/config/config.yaml", Store: "/config/subflux.bolt", Health: health.DefaultPath}

DefaultPaths are the container layout.

Functions

func Run

func Run(ctx context.Context, cfg Config) error

Run boots and serves until ctx ends or a component returns, then drains. It returns a boot failure (the store, the activation of the loaded configuration and the TCP bind included), the component's return that began the drain ("<name> exited" when it returned nil), or a drain overrun; nil when ctx's end began the drain. The store stays open after an overrun, for a request or job still on it. cmd/subflux exits 1 on any error.

Types

type Config

type Config struct {
	// Listener, when set, replaces binding the HTTP port (tests).
	Listener net.Listener
	// LogOutput is where the process logs; nil is stderr.
	LogOutput io.Writer
	// Routes, when set, adds routes to the mux before serving (tests).
	Routes func(*http.ServeMux)
	// Settings, when set, receives the settings service once it is built, so
	// a test can save through it.
	Settings func(*settings.Service)
	// Gather, when set, receives the metrics registry's Gather (tests).
	Gather func(func(context.Context) ([]measure.Family, error))
	// Status, when set, receives the status store once it is built (tests).
	Status func(*status.Store)
	// Scanner, when set, receives the media sources' Scanner once the first
	// Active settings build it (tests).
	Scanner func(*scan.Scanner)
	// Orders, when set, replaces the aired order join over SkyHook (tests).
	Orders mediasource.OrderJoin
	// Store, when set, receives the open state store (tests).
	Store func(*statedb.Store)
	// Writer, when set, receives the media writer once it is built (tests).
	Writer func(*mediawrite.Writer)
	// SourcesApply, when set, runs before the media sources apply each
	// settings commit after boot, and that apply waits for it to return
	// (tests).
	SourcesApply func(context.Context)
	Paths        Paths
}

Config is what Run boots from. Every field but Paths is optional.

type Paths

type Paths struct {
	Config string
	// Store is the state file; statedb locks Store + ".lock" beside it.
	Store string
	// Health is the liveness marker the health subcommand stats.
	Health string
}

Paths are the files the process reads and writes.

Jump to

Keyboard shortcuts

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