Documentation ¶
Overview ¶
Package lifecycle provides application models' lifecycle management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle manages lifecycle for models. Currently a Lifecycle has two phases: Start and Stop. Currently Lifecycle doesn't support soft dependency models and multi-err, so all models in Lifecycle require to be succeed on both phases.
func (*Lifecycle) OnStart ¶
OnStart runs models OnStart function if models implmented it. All OnStart functions will be run in parallel. context passed into models' OnStart method will be canceled on the first time a model's OnStart function return non-nil error.
type Model ¶
type Model interface{}
Model is application model which may require to start and stop in application lifecycle.
type StartStopper ¶
StartStopper is the interface that groups Start and Stop.