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 ¶
- type DiscoveryJobConfig
- type ScanJobConfig
- type ScheduledJob
- type Scheduler
- func (s *Scheduler) AddDiscoveryJob(ctx context.Context, name, cronExpr string, config DiscoveryJobConfig) error
- func (s *Scheduler) AddScanJob(ctx context.Context, name, cronExpr string, config *ScanJobConfig) error
- func (s *Scheduler) DisableJob(ctx context.Context, jobID uuid.UUID) error
- func (s *Scheduler) EnableJob(ctx context.Context, jobID uuid.UUID) error
- func (s *Scheduler) GetJobs() []*ScheduledJob
- func (s *Scheduler) RemoveJob(ctx context.Context, jobID uuid.UUID) error
- func (s *Scheduler) Start() error
- func (s *Scheduler) Stop()
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 ¶
DisableJob disables a scheduled job.
func (*Scheduler) GetJobs ¶
func (s *Scheduler) GetJobs() []*ScheduledJob
GetJobs returns all scheduled jobs from the database.