server

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJoinTimeout = errors.New("server component join timed out")

Functions

This section is empty.

Types

type Component

type Component struct {
	Name string
	Run  func(context.Context) error
	Stop func(context.Context) error
}

type Config

type Config struct {
	ShutdownTimeout time.Duration
	OnDrain         func()
}

type Group

type Group struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) *Group

func (*Group) Add

func (g *Group) Add(component Component)

func (*Group) Run

func (g *Group) Run(ctx context.Context) error

Run owns the complete process lifecycle. The first unexpected component exit begins draining, cancels every sibling, invokes stops in reverse order, and joins all component goroutines before returning.

Jump to

Keyboard shortcuts

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