engine

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadJob

type DownloadJob struct {
	Segment    domain.Segment
	File       *domain.DownloadFile
	Groups     []string
	Offset     int64
	RetryCount int
}

type DownloadResult

type DownloadResult struct {
	Job   DownloadJob
	Error error
}

type Downloader added in v0.5.0

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

Downloader is the concrete implementation of the download engine.

func NewDownloader added in v0.5.0

func NewDownloader(ctx *app.Context, writer *FileWriter) *Downloader

func (*Downloader) Download added in v0.5.0

func (s *Downloader) Download(ctx context.Context, item *domain.QueueItem) error

Download processes a QueueItem from start to finish

func (*Downloader) RenderCLIProgress added in v0.5.0

func (s *Downloader) RenderCLIProgress(item *domain.QueueItem, speedMbps float64, final bool)

func (*Downloader) SetProgressHandler added in v0.5.0

func (s *Downloader) SetProgressHandler(fn func(*domain.QueueItem))

type FileWriter

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

func NewFileWriter

func NewFileWriter() *FileWriter

func (*FileWriter) CloseAll

func (fw *FileWriter) CloseAll()

func (*FileWriter) CloseFile

func (fw *FileWriter) CloseFile(path string, finalSize int64) error

func (*FileWriter) PreAllocate

func (fw *FileWriter) PreAllocate(path string, size int64) error

func (*FileWriter) WriteAt

func (fw *FileWriter) WriteAt(path string, data []byte, offset int64) error

WriteAt finds the handle and performs a thread-safe write

type QueueManager added in v0.5.0

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

func NewQueueManager added in v0.5.0

func NewQueueManager(app *app.Context, loadExisting bool) *QueueManager

Initializes a QueueManager Takes app.Context and loadExisting bool as parameters if loadExisting is true, will load pending items from the database if loadExisting is false, will skip the database lookup (for CLI mode)

func (*QueueManager) Add added in v0.5.0

Add creates a new queue item and persists explicit source provenance. resolver lookup is no longer done here; caller must provide source kind + snapshot.

func (*QueueManager) Cancel added in v0.5.0

func (m *QueueManager) Cancel(id string) bool

func (*QueueManager) Delete added in v0.6.0

func (m *QueueManager) Delete(id string) bool

func (*QueueManager) GetActiveItem added in v0.5.0

func (m *QueueManager) GetActiveItem() *domain.QueueItem

GetActiveItem allows the UI to see what's currently running

func (*QueueManager) GetAllItems added in v0.5.0

func (m *QueueManager) GetAllItems() []*domain.QueueItem

GetAllItems returns a copy of the current queue slice.

func (*QueueManager) GetItem added in v0.5.0

func (m *QueueManager) GetItem(ctx context.Context, id string) (*domain.QueueItem, bool)

GetItem searches the queue for a specific ID. Returns the item and 'true' if found, nil and 'false' otherwise.

func (*QueueManager) HydrateItem added in v0.5.0

func (m *QueueManager) HydrateItem(ctx context.Context, item *domain.QueueItem) error

func (*QueueManager) IsPaused added in v0.6.0

func (m *QueueManager) IsPaused() bool

func (*QueueManager) Pause added in v0.6.0

func (m *QueueManager) Pause() bool

global pause stops new jobs from starting. If a job is active, we cooperatively cancel it and requeue it as pending.

func (*QueueManager) ReloadRuntime added in v0.6.0

func (m *QueueManager) ReloadRuntime(appCtx *app.Context)

refresh future-job runtime dependencies after settings reload Active downloads are not interrupted; this only affects subsequent hydation/download steps

func (*QueueManager) Resume added in v0.6.0

func (m *QueueManager) Resume() bool

resume allows the queue loop to continue processing pending jobs.

func (*QueueManager) Start added in v0.5.0

func (m *QueueManager) Start(ctx context.Context)

func (*QueueManager) Stop added in v0.5.0

func (m *QueueManager) Stop()

func (*QueueManager) UpdateStatus added in v0.5.0

func (m *QueueManager) UpdateStatus(ctx context.Context, item *domain.QueueItem, status domain.JobStatus)

updateStatus changes the status and saves to DB immediately

type WriteRequest

type WriteRequest struct {
	FilePath string
	Offset   int64
	Data     []byte
	Done     chan error // Feedback loop for the worker
}

Jump to

Keyboard shortcuts

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