Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCanOnlyRunOnce is returned when `RunAndWait` is called after already // being called. ErrCanOnlyRunOnce = errors.New("can only run once") // ErrShutdownRequested can be used as a reason for `Kill` that indicates no // error has occurred, just that the components should gracefully exit. ErrShutdownRequested = errors.New("shutdown requested") )
Functions ¶
This section is empty.
Types ¶
type Component ¶
Component is used to represent various "components". At a high level, main() essentially cobbles together a few components whose lifecycles are managed by Tombs. `Component` allows us to treat them as black boxes.
type ComponentWithDependencies ¶
func NewComponentWithDependencies ¶
func NewComponentWithDependencies(c Component, dependencies ...Component) ComponentWithDependencies
type Main ¶
type Main struct {
// contains filtered or unexported fields
}
Main represents a collection of components whose lifecycles are tied together.
func (*Main) RunAndWait ¶
RunAndWait starts all components in this `Main`.
`RunAndWait` will also listen to SIGINT and SIGTERM to do graceful shutdowns of all components it manages. It should only be called once, and returns `ErrCanOnlyRunOnce` if called more than once.
func (*Main) SetShutdownDeadline ¶
type SignalError ¶
type SignalError struct {
// contains filtered or unexported fields
}
SignalError is an `error` returned when `Main` exits due to a signal.
func (*SignalError) Error ¶
func (s *SignalError) Error() string
Click to show internal directories.
Click to hide internal directories.