gthulhu

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MAX_LATENCY_WEIGHT = 1000
	SCX_ENQ_WAKEUP     = 1
	NSEC_PER_SEC       = 1000000000 // 1 second in nanoseconds
	PF_WQ_WORKER       = 0x00000020
)
View Source
const SCX_ENQ_PREEMPT = 1 << 32

Variables

This section is empty.

Functions

This section is empty.

Types

type BssData

type BssData struct {
	UserschedLastRunAt uint64 `json:"usersched_last_run_at"` // The PID of the userspace scheduler
	NrQueued           uint64 `json:"nr_queued"`             // Number of tasks queued in the userspace scheduler
	NrScheduled        uint64 `json:"nr_scheduled"`          // Number of tasks scheduled by the userspace scheduler
	NrRunning          uint64 `json:"nr_running"`            // Number of tasks currently running in the userspace scheduler
	NrOnlineCpus       uint64 `json:"nr_online_cpus"`        // Number of online CPUs in the system
	NrUserDispatches   uint64 `json:"nr_user_dispatches"`    // Number of user-space dispatches
	NrKernelDispatches uint64 `json:"nr_kernel_dispatches"`  // Number of kernel-space dispatches
	NrCancelDispatches uint64 `json:"nr_cancel_dispatches"`  // Number of canceled dispatches
	NrBounceDispatches uint64 `json:"nr_bounce_dispatches"`  // Number of bounce dispatches
	NrFailedDispatches uint64 `json:"nr_failed_dispatches"`  // Number of failed dispatches
	NrSchedCongested   uint64 `json:"nr_sched_congested"`    // Number of times the scheduler was congested
}

BssData represents the metrics data structure that matches the API server

type ErrorResponse

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

ErrorResponse represents error response structure

type GthulhuPlugin

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

func NewGthulhuPlugin

func NewGthulhuPlugin(sliceNsDefault, sliceNsMin uint64) *GthulhuPlugin

func (*GthulhuPlugin) DetermineTimeSlice

func (g *GthulhuPlugin) DetermineTimeSlice(s reg.Sched, t *models.QueuedTask) uint64

func (*GthulhuPlugin) DrainQueuedTask

func (g *GthulhuPlugin) DrainQueuedTask(s reg.Sched) int

func (*GthulhuPlugin) FetchSchedulingStrategies added in v0.1.0

func (g *GthulhuPlugin) FetchSchedulingStrategies(apiUrl string) ([]util.SchedulingStrategy, error)

FetchSchedulingStrategies fetches scheduling strategies from the API server

func (*GthulhuPlugin) GetChangedStrategies added in v1.1.0

func (g *GthulhuPlugin) GetChangedStrategies() ([]util.SchedulingStrategy, []util.SchedulingStrategy)

Campare g.oldStrategyMap and g.strategyMap and return the list of SchedulingStrategy that have changed strategies

func (*GthulhuPlugin) GetJWTClient added in v0.1.0

func (g *GthulhuPlugin) GetJWTClient() *JWTClient

GetJWTClient returns the current JWT client instance

func (*GthulhuPlugin) GetMetricsClient added in v0.1.0

func (g *GthulhuPlugin) GetMetricsClient() *MetricsClient

GetMetricsClient returns the metrics client instance

func (*GthulhuPlugin) GetPoolCount

func (g *GthulhuPlugin) GetPoolCount() uint64

func (*GthulhuPlugin) GetSchedulerConfig added in v0.1.0

func (g *GthulhuPlugin) GetSchedulerConfig() (uint64, uint64)

GetSchedulerConfig returns current scheduler configuration

func (*GthulhuPlugin) InitJWTClient added in v0.1.0

func (g *GthulhuPlugin) InitJWTClient(
	publicKeyPath,
	apiBaseURL string,
	authEnabled bool,
	mtlsCfg reg.MTLSConfig,
) error

InitJWTClient initializes the JWT client for API authentication

func (*GthulhuPlugin) InitMetricsClient added in v0.1.0

func (g *GthulhuPlugin) InitMetricsClient(apiBaseURL string) error

InitMetricsClient initializes the metrics client

func (*GthulhuPlugin) SelectCPU

func (g *GthulhuPlugin) SelectCPU(s reg.Sched, t *models.QueuedTask) (error, int32)

func (*GthulhuPlugin) SelectQueuedTask

func (g *GthulhuPlugin) SelectQueuedTask(s reg.Sched) *models.QueuedTask

func (*GthulhuPlugin) SendMetrics added in v1.0.0

func (g *GthulhuPlugin) SendMetrics(data interface{})

func (*GthulhuPlugin) SetSchedulerConfig added in v0.1.0

func (g *GthulhuPlugin) SetSchedulerConfig(sliceNsDefault, sliceNsMin uint64)

SetSchedulerConfig updates the scheduler parameters

func (*GthulhuPlugin) StartStrategyFetcher added in v0.1.0

func (g *GthulhuPlugin) StartStrategyFetcher(ctx context.Context, apiUrl string, interval time.Duration)

StartStrategyFetcher starts a background goroutine to periodically fetch scheduling strategies

func (*GthulhuPlugin) UpdateStrategyMap added in v0.1.0

func (g *GthulhuPlugin) UpdateStrategyMap(strategies []util.SchedulingStrategy)

UpdateStrategyMap updates the strategy map from a slice of strategies

type JWTClient

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

JWTClient handles JWT authentication for API calls

func NewJWTClient

func NewJWTClient(
	publicKeyPath,
	apiBaseURL string,
	authEnabled bool,
	mtlsCfg reg.MTLSConfig,
) (*JWTClient, error)

NewJWTClient creates a new JWT client. When mtlsCfg.Enable is true the underlying HTTP client is configured with mutual TLS so the plugin authenticates itself to the API server and verifies the server certificate against the shared CA.

func (*JWTClient) GetAuthenticatedClient

func (c *JWTClient) GetAuthenticatedClient() (*http.Client, error)

GetAuthenticatedClient returns an HTTP client with JWT authentication

func (*JWTClient) MakeAuthenticatedRequest

func (c *JWTClient) MakeAuthenticatedRequest(method, url string, body io.Reader) (*http.Response, error)

MakeAuthenticatedRequest makes an HTTP request with JWT authentication

type MetricsClient

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

MetricsClient handles sending metrics to the API server

func NewMetricsClient

func NewMetricsClient(jwtClient *JWTClient, apiBaseURL string) *MetricsClient

NewMetricsClient creates a new metrics client

func (*MetricsClient) SendMetrics

func (c *MetricsClient) SendMetrics(data BssData) error

SendMetrics sends BSS metrics data to the API server

func (*MetricsClient) SendMetricsAsync

func (c *MetricsClient) SendMetricsAsync(data BssData)

SendMetricsAsync sends metrics asynchronously (non-blocking)

type MetricsResponse

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

MetricsResponse represents the response structure from the API server

type Task

type Task struct {
	*models.QueuedTask
	Deadline  uint64
	Timestamp uint64
}

type TokenData added in v1.1.0

type TokenData struct {
	Token     string `json:"token,omitempty"`
	ExpiredAt int64  `json:"expired_at,omitempty"`
}

TokenData represents the data field in JWT token response

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"`
	Data      TokenData `json:"data"`
	Timestamp string    `json:"timestamp"`
}

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