job

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Created time.Time
	Message Message
}

Job represents a job item

type Manifest

type Manifest struct {
	Mutex *sync.RWMutex
	Jobs  map[string]Job
}

Manifest represents the collection of current jobs

func NewManifest

func NewManifest(size int) Manifest

NewManifest creates a new Manifest with a predefined maxSize

func (*Manifest) DeleteJob

func (jm *Manifest) DeleteJob(ID string)

DeleteJob removes a job if it exists, otherwise throws an error

func (*Manifest) GetJob

func (jm *Manifest) GetJob(ID string) Job

GetJob fetches a job by its ID

func (*Manifest) HasJob

func (jm *Manifest) HasJob(ID string) bool

HasJob checks if a job with a given ID already exists

func (*Manifest) InsertJob

func (jm *Manifest) InsertJob(ID string, message Message)

InsertJob inserts a new job and checks that there are no duplicates

func (*Manifest) Size

func (jm *Manifest) Size() int

Size returns the current job manifest size

type Message

type Message interface {
	GetData() []byte
}

Jump to

Keyboard shortcuts

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