scheduler

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package scheduler provides job scheduling and execution functionality for scanorama. It manages scheduled discovery and scanning jobs, handles job queuing, and coordinates the execution of network scans and host discovery operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryJobConfig

type DiscoveryJobConfig struct {
	Network     string `json:"network"`
	Method      string `json:"method"`
	DetectOS    bool   `json:"detect_os"`
	Timeout     int    `json:"timeout_seconds"`
	Concurrency int    `json:"concurrency"`
}

DiscoveryJobConfig represents discovery job configuration.

type ScanJobConfig

type ScanJobConfig struct {
	LiveHostsOnly bool     `json:"live_hosts_only"`
	Networks      []string `json:"networks,omitempty"`
	ProfileID     string   `json:"profile_id,omitempty"`
	MaxAge        int      `json:"max_age_hours"`
	OSFamily      []string `json:"os_family,omitempty"`
}

ScanJobConfig represents scan job configuration.

type ScheduledJob

type ScheduledJob struct {
	ID      uuid.UUID
	CronID  cron.EntryID
	Config  *db.ScheduledJob
	LastRun time.Time
	NextRun time.Time
	Running bool
}

ScheduledJob represents a scheduled job wrapper.

type Scheduler

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

Scheduler manages scheduled discovery and scanning jobs.

func NewScheduler

func NewScheduler(database *db.DB, discoveryEngine *discovery.Engine, profileManager *profiles.Manager) *Scheduler

NewScheduler creates a new job scheduler.

func (*Scheduler) AddDiscoveryJob

func (s *Scheduler) AddDiscoveryJob(ctx context.Context, name, cronExpr string, config DiscoveryJobConfig) error

AddDiscoveryJob adds a new scheduled discovery job.

func (*Scheduler) AddScanJob

func (s *Scheduler) AddScanJob(ctx context.Context, name, cronExpr string, config *ScanJobConfig) error

AddScanJob adds a new scheduled scan job.

func (*Scheduler) DisableJob

func (s *Scheduler) DisableJob(ctx context.Context, jobID uuid.UUID) error

DisableJob disables a scheduled job.

func (*Scheduler) EnableJob

func (s *Scheduler) EnableJob(ctx context.Context, jobID uuid.UUID) error

EnableJob enables a scheduled job.

func (*Scheduler) GetJobs

func (s *Scheduler) GetJobs() []*ScheduledJob

GetJobs returns all scheduled jobs from the database.

func (*Scheduler) RemoveJob

func (s *Scheduler) RemoveJob(ctx context.Context, jobID uuid.UUID) error

RemoveJob removes a scheduled job.

func (*Scheduler) Start

func (s *Scheduler) Start() error

Start begins the scheduler.

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Stop stops the scheduler.

Jump to

Keyboard shortcuts

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