Documentation
¶
Overview ¶
Package breaker contains useful thread-safe abstraction the helps to control lifetime of actors, background tasks, pools etc.
Index ¶
- type Breaker
- func (b *Breaker) Deadline() (deadline time.Time, ok bool)
- func (b *Breaker) Dec()
- func (b *Breaker) Done() <-chan struct{}
- func (b *Breaker) Err() error
- func (b *Breaker) Inc() error
- func (b *Breaker) Shutdown()
- func (b *Breaker) ShutdownAndWait()
- func (b *Breaker) Value(key interface{}) interface{}
- func (b *Breaker) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breaker ¶
type Breaker struct {
// contains filtered or unexported fields
}
Breaker can be used to stop any subsystem with background tasks gracefully.
func NewBreakerWithInitValue ¶
NewBreakerWithInitValue - alternative breaker constructor convenient for usage in pools and actors, when you know how many goroutines will work from the very beginning.
func (*Breaker) Done ¶
func (b *Breaker) Done() <-chan struct{}
Done returns channel which can be used in a manner similar to context.Context.Done().
func (*Breaker) Err ¶
Err returns error which can be used in a manner similar to context.Context.Done().
func (*Breaker) ShutdownAndWait ¶
func (b *Breaker) ShutdownAndWait()
ShutdownAndWait switches breakers in shutdown mode and waits for all background tasks to terminate.