engine

package
v0.0.0-...-dab6a98 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Credential represents a username/password pair for task execution

type ScoringEngine

type ScoringEngine struct {
	Config *config.ConfigSettings

	UptimePerService map[uint]map[string]db.Uptime

	SlaPerService         map[uint]map[string]int
	EnginePauseWg         *sync.WaitGroup
	IsEnginePaused        bool
	CurrentRound          uint
	NextRoundStartTime    time.Time
	CurrentRoundStartTime time.Time
	RedisClient           *redis.Client
	DB                    *db.DB

	// Concurrency control for materialized view refresh
	Refreshing atomic.Bool
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(conf *config.ConfigSettings, configPath string) *ScoringEngine

func NewTestEngine

func NewTestEngine(t *testing.T, redis *testutil.RedisContainer, pg *testutil.PostgresContainer, slaThreshold int) *ScoringEngine

newTestEngine creates a minimal engine for testing

func (*ScoringEngine) EnsureCredentialsSeeded

func (se *ScoringEngine) EnsureCredentialsSeeded() error

func (*ScoringEngine) GetActiveTasks

func (se *ScoringEngine) GetActiveTasks() (map[string]any, error)

GetActiveTasks returns all active and recently completed tasks

func (*ScoringEngine) GetCredlists

func (se *ScoringEngine) GetCredlists() (any, error)

func (*ScoringEngine) GetPCRHistory

func (se *ScoringEngine) GetPCRHistory(teamID uint, credlistName string, username string) ([]db.PCRHistorySchema, error)

GetPCRHistory returns PCR history for admin viewing

func (*ScoringEngine) GetTeamCredentials

func (se *ScoringEngine) GetTeamCredentials(teamID uint, credlistName string) ([]db.CredentialSchema, error)

GetTeamCredentials returns credentials for admin viewing

func (*ScoringEngine) GetUptimePerService

func (se *ScoringEngine) GetUptimePerService() map[uint]map[string]db.Uptime

func (*ScoringEngine) PauseEngine

func (se *ScoringEngine) PauseEngine()

func (*ScoringEngine) RLockUptime

func (se *ScoringEngine) RLockUptime()

func (*ScoringEngine) RUnlockUptime

func (se *ScoringEngine) RUnlockUptime()

func (*ScoringEngine) ResetCredentials

func (se *ScoringEngine) ResetCredentials(teamID uint, credlistName string, changedBy string) error

func (*ScoringEngine) ResetScores

func (se *ScoringEngine) ResetScores() error

ResetScores resets the engine to the initial state and stops the engine

func (*ScoringEngine) ResumeEngine

func (se *ScoringEngine) ResumeEngine()

func (*ScoringEngine) Start

func (se *ScoringEngine) Start()

func (*ScoringEngine) UpdateCredentials

func (se *ScoringEngine) UpdateCredentials(teamID uint, credlistName string, usernames []string, passwords []string) (int, []string, error)

type Task

type Task struct {
	TeamID         uint            `json:"team_id"`         // Numeric identifier for the team
	TeamIdentifier string          `json:"team_identifier"` // Human-readable identifier for the team
	ServiceType    string          `json:"service_type"`
	ServiceName    string          `json:"service_name"`
	Deadline       time.Time       `json:"deadline"`
	RoundID        uint            `json:"round_id"`
	Attempts       int             `json:"attempts"`
	CheckData      json.RawMessage `json:"check_data"`
	Credentials    []Credential    `json:"credentials,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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