Documentation
¶
Overview ¶
Package service defines the Service contract and a production-grade Governor. RACE-SAFE: per-service state is tracked with atomics to avoid data races across the health loop.
Index ¶
- type Governor
- func (g *Governor) ActiveServicesCount() int
- func (g *Governor) Logs() <-chan ServiceLog
- func (g *Governor) Metrics() Metrics
- func (g *Governor) Register(name string, s Service)
- func (g *Governor) Reload(ctx context.Context, name string, cfg any) error
- func (g *Governor) ServiceNames() []string
- func (g *Governor) ServiceState(name string) (ServiceState, bool)
- func (g *Governor) ServicesCount() int
- func (g *Governor) SetEnabled(name string, enabled bool) error
- func (g *Governor) SetInstances(name string, n int) error
- func (g *Governor) Start()
- func (g *Governor) Stop(ctx context.Context) error
- func (g *Governor) TotalInstances() int
- type Level
- type Metrics
- type Scalable
- type Service
- type ServiceLog
- type ServiceState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Governor ¶
type Governor struct {
// contains filtered or unexported fields
}
func NewGovernor ¶
func (*Governor) ActiveServicesCount ¶
func (*Governor) Logs ¶
func (g *Governor) Logs() <-chan ServiceLog
func (*Governor) ServiceNames ¶
func (*Governor) ServiceState ¶
func (g *Governor) ServiceState(name string) (ServiceState, bool)
func (*Governor) TotalInstances ¶
type ServiceLog ¶
Click to show internal directories.
Click to hide internal directories.