Documentation
¶
Index ¶
Constants ¶
View Source
const ( PayloadModeCached = "cached" PayloadModeEphemeral = "ephemeral" )
Variables ¶
This section is empty.
Functions ¶
func CalculateFileHash ¶ added in v0.5.0
CalculateFileHash generates the SHA-256 fingerprint for the actual NZB bytes. This is used for content-based deduplication and manual upload IDs.
func GenerateCompositeID ¶ added in v0.5.0
GenerateCompositeID creates the SHA-256 PK for Indexer results. This ensure all IDs in the database are a consistent 64-character hex string.
Types ¶
type DownloadFile ¶
type DownloadFile struct {
// Persistent fields (saved in release_files table)
ID int64
ReleaseID string
FileName string // Sanitized filename
Size int64 // Expected total size from NZB
Index int // Original order in the NZB
IsPars bool // True if the file is a repar volume
Subject string
Date int64
Groups []string
Poster string
// App State (calulated at hydration)
PartPath string
FinalPath string
IsComplete bool
Password string
Segments []Segment
// contains filtered or unexported fields
}
DownloadFile represents an individual file within a Release.
func NewDownloadFile ¶
func NewDownloadFile(fileName string, size int64, index int, segments []Segment, outDir string, password string) *DownloadFile
NewDownloadFile is the constructor for creating a live download task. If size is 0, it calculates the total size from the segment list.
func (*DownloadFile) GetActualSize ¶
func (f *DownloadFile) GetActualSize() int64
func (*DownloadFile) Prepare ¶ added in v0.5.0
func (f *DownloadFile) Prepare(outDir string)
func (*DownloadFile) SetActualSize ¶
func (f *DownloadFile) SetActualSize(size int64)
type PreparationResult ¶ added in v0.5.0
type PreparationResult struct {
Tasks []*DownloadFile
TotalSize int64
Password string
}
type QueueItem ¶ added in v0.5.0
type QueueItem struct {
ID string // Unique KSUID for this job
ReleaseID string // Reference to the shared Release
Release *Release // Populated via JOIN from store
Status JobStatus
OutDir string
// MIlestone 3 snapshot/reference fields
SourceKind string // manaual | aggregator | usenet_index
SourceReleaseID string
ReleaseTitle string
ReleaseSize int64
ReleaseSnapshotJSON string
// payload durability fields.
PayloadMode string // cached | ephemeral
Resumable bool
// Tasks are only present in RAM. When loaded from queue_items,
// this is nil until hydrated from BLOB store.
Tasks []*DownloadFile
BytesWritten atomic.Int64
CreatedAt time.Time
UpdatedAt time.Time
StartedAt time.Time
// CompletedAt is when the queue item reaches a terminal state.
CompletedAt time.Time
// Historical metrics persisted for queue history.
DownloadedBytes int64
AvgBps int64
DownloadSeconds int64
PostProcessSeconds int64
// Internal runtime markers used to compute durations.
DownloadStartedAt time.Time
ProcessingStartedAt time.Time
Error *string
CancelFunc context.CancelFunc
}
QueueItem represents the entire NZB download process
type QueueItemEvent ¶ added in v0.6.0
type Release ¶ added in v0.5.0
type Release struct {
ID string `json:"id"`
Title string `json:"title"`
Password string `json:"password"`
GUID string `json:"guid"`
Source string `json:"source"`
DownloadURL string `json:"downloadUrl"`
Size int64 `json:"size"`
PublishDate time.Time `json:"publishDate"`
Category string `json:"category"`
CachePresent bool `json:"cache_present"`
CacheBlobSize int64 `json:"cache_blob_size"`
CacheVerifiedAt time.Time `json:"cache_verified_at"`
RedirectAllowed bool
Poster string
}
Release represents the NZB itself, whether from an indexer or a file upload.
Click to show internal directories.
Click to hide internal directories.