rest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(route *mux.Router, h *Handler)

Types

type Claims

type Claims struct {
	ClientID string `json:"client_id"`
	jwt.RegisteredClaims
}

Claims represents JWT token claims

type ErrorResponse

type ErrorResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

ErrorResponse represents error response structure

type GetMetricsResponse

type GetMetricsResponse struct {
	Success          bool            `json:"success"`
	Message          string          `json:"message"`
	Timestamp        string          `json:"timestamp"`
	Data             *domain.BssData `json:"data,omitempty"`
	MetricsTimestamp string          `json:"metrics_timestamp,omitempty"`
}

GetMetricsResponse represents the response structure for getting current metrics

type GetPodPidResponse

type GetPodPidResponse struct {
	Success   bool              `json:"success"`
	Message   string            `json:"message"`
	Timestamp string            `json:"timestamp"`
	Pods      []*domain.PodInfo `json:"pods"`
}

PodPidResponse represents the response structure for pod-pid mapping

type GetSchedulingStrategiesResponse

type GetSchedulingStrategiesResponse struct {
	Success    bool                         `json:"success"`
	Message    string                       `json:"message"`
	Timestamp  string                       `json:"timestamp"`
	Scheduling []*domain.SchedulingStrategy `json:"scheduling"`
}

GetSchedulingStrategiesResponse represents the response structure for scheduling strategies

type Handler

type Handler struct {
	domain.Service
	Config *config.Config
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(params Params) *Handler

func (*Handler) ErrorResponse

func (h *Handler) ErrorResponse(w http.ResponseWriter, status int, errMsg string)

func (Handler) GenTokenHandler

func (h Handler) GenTokenHandler(w http.ResponseWriter, r *http.Request)

GenTokenHandler handles JWT token generation upon public key verification

func (*Handler) GetMetricsHandler

func (h *Handler) GetMetricsHandler(w http.ResponseWriter, r *http.Request)

GetMetricsHandler handles retrieving the latest BSS metrics data

func (*Handler) GetPodPidHandler

func (h *Handler) GetPodPidHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSchedulingStrategiesHandler

func (h *Handler) GetSchedulingStrategiesHandler(w http.ResponseWriter, r *http.Request)

GetSchedulingStrategiesHandler handles the retrieval of current scheduling strategies

func (*Handler) HealthCheck

func (h *Handler) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) JSONBind

func (h *Handler) JSONBind(r *http.Request, dst any) error

func (*Handler) JSONResponse

func (h *Handler) JSONResponse(w http.ResponseWriter, status int, data any)

func (*Handler) SaveMetricsHandler

func (h *Handler) SaveMetricsHandler(w http.ResponseWriter, r *http.Request)

SaveMetricsHandler handles saving BSS metrics data

func (*Handler) SaveSchedulingStrategiesHandler

func (h *Handler) SaveSchedulingStrategiesHandler(w http.ResponseWriter, r *http.Request)

func (*Handler) SuccessResponse

func (h *Handler) SuccessResponse(w http.ResponseWriter, message string)

func (*Handler) Version

func (h *Handler) Version(w http.ResponseWriter, r *http.Request)

type Params

type Params struct {
	Service       domain.Service
	JWTPrivateKey *rsa.PrivateKey
	Config        *config.Config
}

type SaveMetricsRequest

type SaveMetricsRequest struct {
	Usersched_last_run_at uint64 `json:"usersched_last_run_at"` // The PID of the userspace scheduler
	Nr_queued             uint64 `json:"nr_queued"`             // Number of tasks queued in the userspace scheduler
	Nr_scheduled          uint64 `json:"nr_scheduled"`          // Number of tasks scheduled by the userspace scheduler
	Nr_running            uint64 `json:"nr_running"`            // Number of tasks currently running in the userspace scheduler
	Nr_online_cpus        uint64 `json:"nr_online_cpus"`        // Number of online CPUs in the system
	Nr_user_dispatches    uint64 `json:"nr_user_dispatches"`    // Number of user-space dispatches
	Nr_kernel_dispatches  uint64 `json:"nr_kernel_dispatches"`  // Number of kernel-space dispatches
	Nr_cancel_dispatches  uint64 `json:"nr_cancel_dispatches"`  // Number of cancelled dispatches
	Nr_bounce_dispatches  uint64 `json:"nr_bounce_dispatches"`  // Number of bounce dispatches
	Nr_failed_dispatches  uint64 `json:"nr_failed_dispatches"`  // Number of failed dispatches
	Nr_sched_congested    uint64 `json:"nr_sched_congested"`    // Number of times the scheduler was congested
}

SaveMetricsRequest represents the request structure for saving BSS metrics

func (*SaveMetricsRequest) LogValue

func (req *SaveMetricsRequest) LogValue() slog.Value

type SaveStrategyRequest

type SaveStrategyRequest struct {
	Strategies []*domain.SchedulingStrategy `json:"strategies"`
}

StrategyRequest represents the request structure for setting scheduling strategies

type SuccessResponse

type SuccessResponse struct {
	Success   bool   `json:"success"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
}

SuccessResponse represents the success response structure

type TokenRequest

type TokenRequest struct {
	PublicKey string `json:"public_key"` // PEM encoded public key
}

TokenRequest represents the request structure for JWT token generation

type TokenResponse

type TokenResponse struct {
	Success   bool   `json:"success"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
	Token     string `json:"token,omitempty"`
}

TokenResponse represents the response structure for JWT token generation

Jump to

Keyboard shortcuts

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