service

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound           = errors.New("not found")
	ErrConflict           = errors.New("conflict")
	ErrInvalidCredentials = errors.New("invalid credentials")
	ErrInvalidSchedule    = errors.New("invalid schedule")
)

Functions

This section is empty.

Types

type DownloadListResult

type DownloadListResult struct {
	Downloads []generated.DownloadEntry
	Total     int
}

type FileListResult

type FileListResult struct {
	Files []generated.File
	Total int
}

type Service

type Service struct {
	DB         *database.DB
	Auth       *auth.Service
	Registry   *sources.Registry
	Downloader *downloader.Downloader
	Scheduler  *scheduler.Scheduler // can be nil (CLI mode)
	Hooks      *hooks.Manager
	Version    string
	// contains filtered or unexported fields
}

func New

func New(
	db *database.DB,
	authService *auth.Service,
	registry *sources.Registry,
	dl *downloader.Downloader,
	sched *scheduler.Scheduler,
	hooksManager *hooks.Manager,
	version string,
) *Service

func (*Service) ActiveDownloads

func (s *Service) ActiveDownloads() []downloader.DownloadProgress

func (*Service) CancelDownload

func (s *Service) CancelDownload(id string) error

func (*Service) CreateWebhook

func (s *Service) CreateWebhook(name, url string, events []string) (generated.Webhook, error)

func (*Service) DeleteFile

func (s *Service) DeleteFile(id string) error

func (*Service) DeleteWebhook

func (s *Service) DeleteWebhook(id int) error

func (*Service) DownloadFile

func (s *Service) DownloadFile(id string)

func (*Service) DownloadPendingFiles

func (s *Service) DownloadPendingFiles(productID string)

func (*Service) GetFile

func (s *Service) GetFile(id string) (generated.FileWithHistory, error)

func (*Service) GetProduct

func (s *Service) GetProduct(id string) (generated.ProductWithDeliveries, error)

func (*Service) GetSchedule

func (s *Service) GetSchedule() ([]generated.ProductSchedule, error)

func (*Service) GetSource

func (s *Service) GetSource(id string) (generated.Source, error)

func (*Service) GetStats

func (s *Service) GetStats() (generated.StatsResponse, error)

func (*Service) HealthCheck

func (s *Service) HealthCheck() generated.HealthResponse

func (*Service) ListDownloads

func (s *Service) ListDownloads(status *string, offset, limit int) (DownloadListResult, error)

func (*Service) ListFiles

func (s *Service) ListFiles(sourceID, productID *string, status *generated.ListFilesParamsStatus, offset, limit int) (FileListResult, error)

func (*Service) ListProducts

func (s *Service) ListProducts(sourceID *string) ([]generated.Product, error)

func (*Service) ListSources

func (s *Service) ListSources() ([]generated.Source, error)

func (*Service) ListWebhooks

func (s *Service) ListWebhooks() ([]generated.Webhook, error)

func (*Service) ResetFile

func (s *Service) ResetFile(id string) error

NOTE: There is a small TOCTOU race between the IsActive check and the delete. In the worst case, a download that starts between the check and delete will have its entry removed, causing it to appear as "available" again. This is acceptable since the window is very narrow and the consequence is a re-download, not data loss.

func (*Service) SkipFile

func (s *Service) SkipFile(id string) error

func (*Service) StatusVersion

func (s *Service) StatusVersion() uint64

func (*Service) SyncProduct

func (s *Service) SyncProduct(ctx context.Context, id string) error

func (*Service) SyncProductFull

func (s *Service) SyncProductFull(productID string) error

func (*Service) SyncSourceFiles

func (s *Service) SyncSourceFiles(sourceID string) error

func (*Service) SyncSourceProducts

func (s *Service) SyncSourceProducts(sourceID string) error

func (*Service) TestCredentials

func (s *Service) TestCredentials(ctx context.Context, id string, credentials map[string]string) error

func (*Service) UnskipFile

func (s *Service) UnskipFile(id string) error

func (*Service) UpdateProductSchedule

func (s *Service) UpdateProductSchedule(productID string, req generated.UpdateScheduleRequest) (generated.ProductSchedule, error)

func (*Service) UpdateSource

func (s *Service) UpdateSource(ctx context.Context, id string, enabled *bool, credentials *map[string]string) (generated.Source, error)

func (*Service) UpdateWebhook

func (s *Service) UpdateWebhook(id int, req generated.UpdateWebhookRequest) (generated.Webhook, error)

Jump to

Keyboard shortcuts

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