Documentation
¶
Overview ¶
Package server hosts the HTTP and (later) HTTPS listeners. Multiple servers share one http.Handler and run concurrently under an Orchestrator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator runs multiple Server instances concurrently and shuts them down together on context cancellation or first non-expected error.
func NewOrchestrator ¶
func NewOrchestrator(servers ...Server) *Orchestrator
NewOrchestrator constructs an Orchestrator over non-nil servers.
func (*Orchestrator) Start ¶
func (o *Orchestrator) Start(ctx context.Context) (err error)
Start blocks until ctx is cancelled or any server fails.
func (*Orchestrator) WithShutdownTimeout ¶
func (o *Orchestrator) WithShutdownTimeout(d time.Duration) *Orchestrator
WithShutdownTimeout overrides the default shutdown grace period.
type Server ¶
type Server interface {
ListenAndServe() error
Shutdown(ctx context.Context) error
IsExpectedStopErr(err error) bool
}
Server is the minimum surface the Orchestrator needs.
Click to show internal directories.
Click to hide internal directories.