handler

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetModeRequest

type SetModeRequest struct {
	Mode string `json:"mode"`
}

SetModeRequest represents a mode switch request.

type SimulationHandler

type SimulationHandler struct {
	// contains filtered or unexported fields
}

SimulationHandler handles HTTP requests for simulation control

func NewSimulationHandler

func NewSimulationHandler(
	engine *service.SimulationEngine,
	cfg *config.SimulationConfig,
	met *metrics.SimulationMetrics,
) *SimulationHandler

NewSimulationHandler creates a new simulation handler

func (*SimulationHandler) GetConfig

func (h *SimulationHandler) GetConfig(w http.ResponseWriter, r *http.Request)

GetConfig handles GET /api/v1/simulation/config Returns current simulation configuration.

func (*SimulationHandler) GetMetrics

func (h *SimulationHandler) GetMetrics(w http.ResponseWriter, r *http.Request)

GetMetrics handles GET /api/v1/simulation/metrics Returns simulation metrics.

func (*SimulationHandler) GetStatus

func (h *SimulationHandler) GetStatus(w http.ResponseWriter, r *http.Request)

GetStatus returns the current simulation status

func (*SimulationHandler) ResetMetrics

func (h *SimulationHandler) ResetMetrics(w http.ResponseWriter, r *http.Request)

ResetMetrics handles POST /api/v1/simulation/metrics/reset Resets simulation metrics.

func (*SimulationHandler) SetMode

func (h *SimulationHandler) SetMode(w http.ResponseWriter, r *http.Request)

SetMode handles POST /api/v1/simulation/mode Switches between realistic and demo modes.

func (*SimulationHandler) StartSimulation

func (h *SimulationHandler) StartSimulation(w http.ResponseWriter, r *http.Request)

StartSimulation starts the simulation engine

func (*SimulationHandler) StopSimulation

func (h *SimulationHandler) StopSimulation(w http.ResponseWriter, r *http.Request)

StopSimulation stops the simulation engine

func (*SimulationHandler) UpdateConfig

func (h *SimulationHandler) UpdateConfig(w http.ResponseWriter, r *http.Request)

UpdateConfig handles PUT /api/v1/simulation/config Updates simulation configuration.

type StatusResponse

type StatusResponse struct {
	Running bool   `json:"running"`
	Message string `json:"message"`
}

StatusResponse represents the status response

type UpdateConfigRequest

type UpdateConfigRequest struct {
	Mode            *string  `json:"mode,omitempty"`
	FailureRate     *float64 `json:"failure_rate,omitempty"`
	MinDelayMs      *int     `json:"min_delay_ms,omitempty"`
	MaxDelayMs      *int     `json:"max_delay_ms,omitempty"`
	FailuresEnabled *bool    `json:"failures_enabled,omitempty"`
}

UpdateConfigRequest represents a configuration update request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL