Documentation
¶
Overview ¶
Package boot starts components in dataflow order and passes their outputs to downstream components once startup succeeds.
This is not a dynamic graph. It validates and starts one fixed set of components. Do any work that decides which components should participate up front, before the graph starts. Startup makes one forward pass, running independent components in parallel. Shutdown follows the same dataflow edges in reverse. The graph does not restart anything or run startup again.
Use ProvideN for a component that publishes a value to downstream work. Its start callback must not return until that value is ready to use; the graph can order callback completion, but it cannot infer what readiness means for the value. Use RunN for side-effect-only work. A dependent component can name that work with DependsOn when it needs completion but no value from it.
Index ¶
- func Provide0[O any](name string, start func(context.Context) (O, error), options ...Option) (*Component, Output[O])
- func Provide1[A, O any](name string, a Output[A], start func(context.Context, A) (O, error), ...) (*Component, Output[O])
- func Provide2[A, B, O any](name string, a Output[A], b Output[B], ...) (*Component, Output[O])
- func Provide3[A, B, C, O any](name string, a Output[A], b Output[B], c Output[C], ...) (*Component, Output[O])
- func Provide4[A, B, C, D, O any](name string, a Output[A], b Output[B], c Output[C], d Output[D], ...) (*Component, Output[O])
- func Provide5[A, B, C, D, E, O any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) (*Component, Output[O])
- func Provide6[A, B, C, D, E, F, O any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) (*Component, Output[O])
- func Provide7[A, B, C, D, E, F, G, O any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) (*Component, Output[O])
- type Component
- func Run0(name string, start func(context.Context) error, options ...Option) *Component
- func Run1[A any](name string, a Output[A], start func(context.Context, A) error, ...) *Component
- func Run2[A, B any](name string, a Output[A], b Output[B], start func(context.Context, A, B) error, ...) *Component
- func Run3[A, B, C any](name string, a Output[A], b Output[B], c Output[C], ...) *Component
- func Run4[A, B, C, D any](name string, a Output[A], b Output[B], c Output[C], d Output[D], ...) *Component
- func Run5[A, B, C, D, E any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) *Component
- func Run6[A, B, C, D, E, F any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) *Component
- func Run7[A, B, C, D, E, F, G any](name string, a Output[A], b Output[B], c Output[C], d Output[D], e Output[E], ...) *Component
- type Graph
- type Option
- type Output
- type StopFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component defines one participant in the boot dataflow graph.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph owns component startup and reverse shutdown ordering.
func (*Graph) Add ¶
Add registers a component with the graph. All components must be added before Validate or Start is called.
func (*Graph) Start ¶
Start validates the graph, starts independent components concurrently, and waits until every component has returned successfully.
type Option ¶
type Option func(*Component)
Option adds dependencies or lifecycle behavior to a component.
type Output ¶
type Output[T any] struct { // contains filtered or unexported fields }
Output is a ready-to-use value published after its producer starts successfully.
func ResolvedOutput ¶
ResolvedOutput returns an already-published value for focused component tests that do not assemble a graph.