jobs

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 1 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 {
	Status    string            `json:"status"`
	Message   string            `json:"message"` // i18n key
	Data      map[string]string `json:"data,omitempty"`
	Progress  int               `json:"progress"`
	Operation string            `json:"operation"` // e.g., "downloading", "compressing", "uploading"
}

Job represents the state of a single PDF process

type Store

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

Store holds all jobs in memory

func NewStore

func NewStore() *Store

func (*Store) Create

func (s *Store) Create(id string)

func (*Store) Get

func (s *Store) Get(id string) (*Job, bool)

func (*Store) Subscribe added in v1.1.2

func (s *Store) Subscribe(id string) (<-chan *Job, func())

Subscribe returns a channel that receives job updates for the given id. The returned function should be called to unsubscribe when done.

func (*Store) Update

func (s *Store) Update(id, status, msg string, data map[string]string)

func (*Store) UpdateProgress added in v1.1.1

func (s *Store) UpdateProgress(id string, p int)

UpdateProgress sets the progress (0-100) for a job.

func (*Store) UpdateWithOperation added in v1.2.0

func (s *Store) UpdateWithOperation(id, status, msg string, data map[string]string, operation string)

UpdateWithOperation updates message, optional data, and operation type

Jump to

Keyboard shortcuts

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