memory

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package memory is an in-memory repository for storing and managing Agent Jobs and associated Job tracking structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Repository is the structure that implements the in-memory repository for interacting with Agent Jobs

func NewRepository

func NewRepository() *Repository

NewRepository creates and returns a new in-memory repository for interacting with Agent Jobs

func (*Repository) Add

func (r *Repository) Add(job jobs2.Job, info jobs.Info)

Add the Job and associated Info tracking structure to the repository

func (*Repository) Clear

func (r *Repository) Clear(agentID uuid.UUID) error

Clear removes all Jobs that have not already been sent to the associated Agent

func (*Repository) ClearAll

func (r *Repository) ClearAll() error

ClearAll removes all Jobs that have not already been sent for ALL Agents

func (*Repository) GetAll

func (r *Repository) GetAll() map[string]jobs.Info

GetAll returns all Job Info tracking structures as map to be iterated over

func (*Repository) GetInfo

func (r *Repository) GetInfo(jobID string) (jobs.Info, error)

GetInfo returns the Job Info tracking structure for the associate Job ID

func (*Repository) GetJobs

func (r *Repository) GetJobs(agentID uuid.UUID) (jobs []jobs2.Job, err error)

GetJobs returns all jobs waiting to be sent to the associated Agent

func (*Repository) UpdateInfo

func (r *Repository) UpdateInfo(info jobs.Info) error

UpdateInfo replaces the Job Info tracking structure with the one provided

Jump to

Keyboard shortcuts

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