job

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package job is a service used to interact with Agent Jobs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithJobMemoryRepository

func WithJobMemoryRepository() infoJobs.Repository

Types

type Service

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

Service holds references to repositories to manage Job objects

func NewJobService

func NewJobService() *Service

NewJobService is a factory to create a Job service to be used by other packages or services

func (*Service) Add

func (s *Service) Add(agentID uuid.UUID, jobType string, jobArgs []string) (string, error)

func (*Service) AddJobChannel

func (s *Service) AddJobChannel(agentID uuid.UUID, job *jobs.Job, jobArgs []string) (results string, err error)

AddJobChannel adds an already built Agent Job to the agent's job channel to be sent to the agent when it checks in. A server-side job tracking structure is also added to track job status

func (*Service) Clear

func (s *Service) Clear(agentID uuid.UUID) error

Clear removes any jobs in the queue that have been created, but NOT sent to the agent

func (*Service) ClearAll

func (s *Service) ClearAll() error

ClearAll removes all unsent jobs across all agents

func (*Service) Get

func (s *Service) Get(agentID uuid.UUID) ([]jobs.Job, error)

Get returns a list of jobs that need to be sent to the agent

func (*Service) GetAgentActive

func (s *Service) GetAgentActive(agentID uuid.UUID) ([]infoJobs.Info, error)

func (*Service) GetAll

func (s *Service) GetAll() []infoJobs.Info

GetAll returns a map of all jobs in the job repository

func (*Service) GetAllActive

func (s *Service) GetAllActive() []infoJobs.Info

GetAllActive returns a list of all jobs that are not complete or canceled

func (*Service) GetTableActive

func (s *Service) GetTableActive(agentID uuid.UUID) ([][]string, error)

GetTableActive returns a list of rows that contain information about active jobs

func (*Service) GetTableAll

func (s *Service) GetTableAll() [][]string

GetTableAll returns all unsent jobs to be displayed as a table

func (*Service) Handler

func (s *Service) Handler(agentJobs []jobs.Job) error

Handler evaluates a message sent in by the agent and the subsequently executes any corresponding tasks

Jump to

Keyboard shortcuts

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