Documentation
¶
Index ¶
- type BackgroundService
- type BackgroundServiceAdapter
- type Host
- type HostBuilder
- func (b *HostBuilder) AddHostedService(svc HostedService) *HostBuilder
- func (b *HostBuilder) AddService(svc BackgroundService) *HostBuilder
- func (b *HostBuilder) Build() *Host
- func (b *HostBuilder) ConfigureServices(fn func(*di.Builder)) *HostBuilder
- func (b *HostBuilder) ConfigureWeb(fn func(*srv.Server)) *HostBuilder
- func (b *HostBuilder) OnStart(fn func()) *HostBuilder
- func (b *HostBuilder) OnStop(fn func()) *HostBuilder
- func (b *HostBuilder) WithAddr(addr string) *HostBuilder
- func (b *HostBuilder) WithHealthRegistry(r *health.Registry) *HostBuilder
- func (b *HostBuilder) WithShutdownTimeout(d time.Duration) *HostBuilder
- func (b *HostBuilder) WithStartupTimeout(d time.Duration) *HostBuilder
- type HostState
- type HostedService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundService ¶
BackgroundService is a long-running service started in parallel.
type BackgroundServiceAdapter ¶
type BackgroundServiceAdapter struct {
Svc BackgroundService
}
BackgroundServiceAdapter wraps a BackgroundService as a HostedService.
type Host ¶
type Host struct {
Container *di.Container
Server *srv.Server
HealthRegistry *health.Registry
ShutdownTimeout time.Duration
// contains filtered or unexported fields
}
Host manages the lifecycle of the application.
func (*Host) AddHostedService ¶
func (h *Host) AddHostedService(svc HostedService)
type HostBuilder ¶
type HostBuilder struct {
// contains filtered or unexported fields
}
HostBuilder provides a fluent API for constructing a Host.
func (*HostBuilder) AddHostedService ¶
func (b *HostBuilder) AddHostedService(svc HostedService) *HostBuilder
func (*HostBuilder) AddService ¶
func (b *HostBuilder) AddService(svc BackgroundService) *HostBuilder
func (*HostBuilder) Build ¶
func (b *HostBuilder) Build() *Host
func (*HostBuilder) ConfigureServices ¶
func (b *HostBuilder) ConfigureServices(fn func(*di.Builder)) *HostBuilder
func (*HostBuilder) ConfigureWeb ¶
func (b *HostBuilder) ConfigureWeb(fn func(*srv.Server)) *HostBuilder
func (*HostBuilder) OnStart ¶
func (b *HostBuilder) OnStart(fn func()) *HostBuilder
func (*HostBuilder) OnStop ¶
func (b *HostBuilder) OnStop(fn func()) *HostBuilder
func (*HostBuilder) WithAddr ¶
func (b *HostBuilder) WithAddr(addr string) *HostBuilder
func (*HostBuilder) WithHealthRegistry ¶
func (b *HostBuilder) WithHealthRegistry(r *health.Registry) *HostBuilder
func (*HostBuilder) WithShutdownTimeout ¶
func (b *HostBuilder) WithShutdownTimeout(d time.Duration) *HostBuilder
func (*HostBuilder) WithStartupTimeout ¶
func (b *HostBuilder) WithStartupTimeout(d time.Duration) *HostBuilder
type HostState ¶
type HostState int32
HostState represents the current lifecycle state of a Host.
const ( // HostStarting indicates the host is starting hosted services. HostStarting HostState = iota // HostRunning indicates the host is fully running. HostRunning // HostStopping indicates the host is shutting down. HostStopping // HostStopped indicates the host has finished shutting down. HostStopped )
Click to show internal directories.
Click to hide internal directories.