Documentation
¶
Index ¶
- Variables
- type Controller
- func (m *Controller) GetState() *state.NetworkState
- func (m *Controller) LoadPreset(name string, params map[string]int) error
- func (m *Controller) Rebuild(cfg config.EntityConfig) error
- func (m *Controller) Run(ctx context.Context, cfg config.EntityConfig, cycles uint64) error
- func (m *Controller) SetState(ns state.NetworkState)
- func (m *Controller) Subscribe() <-chan state.NetworkState
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilContext = errors.New("nil context") ErrNoCycles = errors.New("cycles must be > 0") )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a simple simulation controller for testing purposes.
func NewController ¶
func NewController() *Controller
NewController creates a mock controller ready for injection.
func (*Controller) GetState ¶
func (m *Controller) GetState() *state.NetworkState
GetState returns the last recorded state.
func (*Controller) LoadPreset ¶
func (m *Controller) LoadPreset(name string, params map[string]int) error
LoadPreset loads a pre-defined network topology.
func (*Controller) Rebuild ¶
func (m *Controller) Rebuild(cfg config.EntityConfig) error
Rebuild resets the simulation state based on the provided configuration.
func (*Controller) Run ¶
func (m *Controller) Run(ctx context.Context, cfg config.EntityConfig, cycles uint64) error
Run satisfies the simulation controller contract.
func (*Controller) SetState ¶
func (m *Controller) SetState(ns state.NetworkState)
SetState updates the current network state.
func (*Controller) Subscribe ¶
func (m *Controller) Subscribe() <-chan state.NetworkState
Subscribe returns a channel that receives state updates.
Click to show internal directories.
Click to hide internal directories.