Documentation ¶
Overview ¶
package lifetime provides common component lifetime control logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lifetime ¶
type Lifetime[T any] interface { // SetState is the method to change lifetime state. SetState(state T) // GetState returns current state. GetState() T // Add records a task is running, returns false if the lifetime is not healthy. Add(isHealthy IsHealthy[T]) bool // Done records a task is done. Done() // Wait waits until all tasks are done. Wait() }
Lifetime interface for lifetime control.
func NewLifetime ¶
NewLifetime returns a new instance of Lifetime with init state and isHealthy logic.
Click to show internal directories.
Click to hide internal directories.