service

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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoBssData = errors.New("no BSS metrics data available")
)

Functions

This section is empty.

Types

type Claims

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

Claims represents JWT token claims

type Params

type Params struct {
	K8sAdapter    kubernetes.K8sAdapter
	StrategyCache *cache.StrategyCache
	JWTPrivateKey *rsa.PrivateKey
	Config        *config.Config
}

Params holds the parameters for creating a new Service

type Service

type Service struct {
	kubernetes.K8sAdapter
	*cache.StrategyCache
	// contains filtered or unexported fields
}

Service represents the main service structure

func NewService

func NewService(ctx context.Context, params Params) (*Service, error)

NewService creates a new Service instance

func (*Service) FindCurrentUsingSchedulingStrategiesWithPID

func (svc *Service) FindCurrentUsingSchedulingStrategiesWithPID(ctx context.Context) ([]*domain.SchedulingStrategy, bool, error)

FindCurrentUsingSchedulingStrategies finds the current scheduling strategies being used

func (*Service) FindPodInfoFrom

func (svc *Service) FindPodInfoFrom(ctx context.Context, rootDir string) ([]*domain.PodInfo, error)

FindPodInfoFrom scans the given rootDir (e.g., /proc) to find pod information

func (*Service) FindSchedulingStrategiesWithPID

func (svc *Service) FindSchedulingStrategiesWithPID(ctx context.Context, rootDir string, usingStrategies []*domain.SchedulingStrategy) ([]*domain.SchedulingStrategy, bool, error)

FindSchedulingStrategiesWithPID finds scheduling strategies with associated PIDs

func (*Service) GetAllPodInfos

func (svc *Service) GetAllPodInfos(ctx context.Context) ([]*domain.PodInfo, error)

GetAllPodInfos retrieves all pod information by scanning the /proc filesystem

func (*Service) GetBSSMetrics

func (svc *Service) GetBSSMetrics(ctx context.Context) (*domain.BssData, error)

GetBSSMetrics retrieves the latest BSS metrics data

func (*Service) GetStrategyCacheStats

func (svc *Service) GetStrategyCacheStats() map[string]any

GetStrategyCacheStats returns statistics about the strategy cache

func (*Service) SaveBSSMetrics

func (svc *Service) SaveBSSMetrics(ctx context.Context, bssMetrics *domain.BssData) error

SaveBSSMetrics saves the provided BSS metrics data

func (*Service) SaveSchedulingStrategy

func (svc *Service) SaveSchedulingStrategy(ctx context.Context, strategy []*domain.SchedulingStrategy) error

SaveSchedulingStrategy saves the provided scheduling strategies and invalidates the cache

func (*Service) VerifyAndGenerateToken

func (svc *Service) VerifyAndGenerateToken(ctx context.Context, publicKey string) (string, error)

VerifyAndGenerateToken verifies the provided public key and generates a JWT token if valid

func (*Service) VerifyPublicKey

func (svc *Service) VerifyPublicKey(publicKeyPEM string) error

verifyPublicKey verifies if the provided public key matches our private key

Jump to

Keyboard shortcuts

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