registry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearRegistryForTests

func ClearRegistryForTests()

The following helpers are intended for tests only.

func GetRegisteredModes

func GetRegisteredModes() []string

GetRegisteredModes returns a list of all registered plugin modes

func RegisterNewPlugin

func RegisterNewPlugin(mode string, factory PluginFactory) error

RegisterNewPlugin registers a plugin factory for a specific mode This should be called in the init() function of each plugin implementation

func RestoreRegistryForTests

func RestoreRegistryForTests(m map[string]PluginFactory)

func SnapshotRegistryForTests

func SnapshotRegistryForTests() map[string]PluginFactory

Types

type APIConfig

type APIConfig struct {
	PublicKeyPath string `yaml:"public_key_path"`
	BaseURL       string `yaml:"base_url"`
	Interval      int    `yaml:"interval"`
	Enabled       bool   `yaml:"enabled"`
	AuthEnabled   bool   `yaml:"auth_enabled"`
}

type CustomScheduler

type CustomScheduler interface {
	// Drain the queued task from eBPF and return the number of tasks drained
	DrainQueuedTask(s Sched) int
	// Select a task from the queued tasks and return it
	SelectQueuedTask(s Sched) *models.QueuedTask
	// Select a CPU for the given queued task, After selecting the CPU, the task will be dispatched to that CPU by Scheduler
	SelectCPU(s Sched, t *models.QueuedTask) (error, int32)
	// Determine the time slice for the given task
	DetermineTimeSlice(s Sched, t *models.QueuedTask) uint64
	// Get the number of objects in the pool (waiting to be dispatched)
	// GetPoolCount will be called by the scheduler to notify the number of tasks waiting to be dispatched (NotifyComplete)
	GetPoolCount() uint64
	// SendMetrics sends custom metrics to the monitoring system
	SendMetrics(interface{})
	// GetChangedStrategies returns the list of scheduling strategies that have changed since the last call
	GetChangedStrategies() ([]util.SchedulingStrategy, []util.SchedulingStrategy)
}

func NewSchedulerPlugin

func NewSchedulerPlugin(ctx context.Context, config *SchedConfig) (CustomScheduler, error)

NewSchedulerPlugin creates a new scheduler plugin based on the configuration This is the factory function that follows the simple factory pattern

type PluginFactory

type PluginFactory func(ctx context.Context, config *SchedConfig) (CustomScheduler, error)

PluginFactory is a function type that creates a CustomScheduler instance

type Sched

type Sched interface {
	DequeueTask(task *models.QueuedTask)
	DefaultSelectCPU(t *models.QueuedTask) (error, int32)
}

type SchedConfig

type SchedConfig struct {
	// Mode specifies which scheduler plugin to use (e.g., "gthulhu", "simple", "simple-fifo")
	Mode string `yaml:"mode"`

	// Scheduler configuration (for Gthulhu plugin)
	// These match the parameters that would be passed from the Gthulhu main repo
	Scheduler Scheduler `yaml:"scheduler"`

	// API configuration
	APIConfig APIConfig `yaml:"api_config"`
}

SchedConfig holds the configuration parameters for creating a scheduler plugin

type Scheduler

type Scheduler struct {
	SliceNsDefault uint64 `yaml:"slice_ns_default"`
	SliceNsMin     uint64 `yaml:"slice_ns_min"`
}

Jump to

Keyboard shortcuts

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