Documentation
¶
Index ¶
- Variables
- type Clock
- type Component
- func (c *Component) Degrade(err error)
- func (c *Component) Fault(err error)
- func (c *Component) Health() Health
- func (c *Component) Kill(ctx context.Context) error
- func (c *Component) Start(ctx context.Context) error
- func (c *Component) State() ComponentState
- func (c *Component) Stop(ctx context.Context) error
- type ComponentHooks
- type ComponentState
- type EndpointHandler
- type Envelope
- type Health
- type LiveClock
- type MsgBus
- func (b *MsgBus) Publish(ctx context.Context, topic string, message any) error
- func (b *MsgBus) RegisterEndpoint(endpoint string, handler EndpointHandler)
- func (b *MsgBus) Request(ctx context.Context, endpoint string, payload any) (Response, error)
- func (b *MsgBus) Stats() MsgBusStats
- func (b *MsgBus) Subscribe(topic string, buffer int) Subscription
- type MsgBusConfig
- type MsgBusStats
- type Request
- type Response
- type Subscription
- type TestClock
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBackpressure = errors.New("msgbus backpressure") ErrEndpointNotFound = errors.New("endpoint not found") )
View Source
var ErrComponentFaulted = errors.New("component faulted")
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
func NewComponent ¶
func NewComponent(id string, hooks ComponentHooks) *Component
func (*Component) State ¶
func (c *Component) State() ComponentState
type ComponentHooks ¶
type ComponentState ¶
type ComponentState string
const ( ComponentStateInitialized ComponentState = "initialized" ComponentStateStarting ComponentState = "starting" ComponentStateRunning ComponentState = "running" ComponentStateStopping ComponentState = "stopping" ComponentStateStopped ComponentState = "stopped" ComponentStateDegraded ComponentState = "degraded" ComponentStateFaulted ComponentState = "faulted" )
type Health ¶
type Health struct {
ID string
State ComponentState
LastError string
}
type MsgBus ¶
type MsgBus struct {
// contains filtered or unexported fields
}
func NewMsgBus ¶
func NewMsgBus(cfg MsgBusConfig) *MsgBus
func (*MsgBus) RegisterEndpoint ¶
func (b *MsgBus) RegisterEndpoint(endpoint string, handler EndpointHandler)
func (*MsgBus) Stats ¶
func (b *MsgBus) Stats() MsgBusStats
type MsgBusConfig ¶
type MsgBusStats ¶
type Subscription ¶
type TestClock ¶
type TestClock struct {
// contains filtered or unexported fields
}
func NewTestClock ¶
Click to show internal directories.
Click to hide internal directories.