Documentation
¶
Index ¶
- type Config
- type Manager
- func (m *Manager) EnqueueFileDeletion(job *job.FileDeletionJob) error
- func (m *Manager) EnqueueFileImport(job *job.FileImportJob) error
- func (m *Manager) EnqueueThumbnail(job *job.ThumbnailJob) error
- func (m *Manager) RecoverPendingJobs() error
- func (m *Manager) Shutdown()
- func (m *Manager) Start() error
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// FileImportWorkers defines the number of concurrent workers for file import jobs
FileImportWorkers uint
// ThumbnailWorkers defines the number of concurrent workers for thumbnail generation jobs
ThumbnailWorkers uint
// FileDeletionWorkers defines the number of concurrent workers for file deletion jobs
FileDeletionWorkers uint
// ChannelBufferSize defines the buffer size for job channels
// A larger buffer allows more jobs to be queued in memory before blocking
ChannelBufferSize uint
}
Config holds the configuration for the worker system
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default worker configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates all worker pools and job distribution
func NewManager ¶
NewManager creates a new worker manager with the given configuration
func (*Manager) EnqueueFileDeletion ¶
func (m *Manager) EnqueueFileDeletion(job *job.FileDeletionJob) error
EnqueueFileDeletion submits a file deletion job to the worker pool
func (*Manager) EnqueueFileImport ¶
func (m *Manager) EnqueueFileImport(job *job.FileImportJob) error
EnqueueFileImport submits a file import job to the worker pool
func (*Manager) EnqueueThumbnail ¶
func (m *Manager) EnqueueThumbnail(job *job.ThumbnailJob) error
EnqueueThumbnail submits a thumbnail job to the worker pool
func (*Manager) RecoverPendingJobs ¶
RecoverPendingJobs loads pending jobs from the database and submits them to workers This should be called once at application startup, after Start()
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents a pool of workers processing jobs from a channel
func (*Pool) Close ¶
func (p *Pool) Close()
Close closes the job channel No more jobs can be submitted after this
func (*Pool) Start ¶
Start launches all workers in the pool Workers will run until the context is cancelled
func (*Pool) Submit ¶
Submit adds a job to the pool's queue This call may BLOCK if the channel buffer is full (default: 100 jobs) and all workers are busy processing. It will unblock once a worker finishes a job and frees space in the queue. Returns an error if the context is cancelled while waiting