summaryrefslogtreecommitdiffstats
path: root/state/state.go
blob: 8ad12e32717f882af0efcb3f37d98bd07d17d8db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: ISC
// Copyright © 2021 siddharth <s@ricketyspace.net>

package state

// Contains the result of processing a Feed.
type FeedResult struct {
	FeedId string // Feed's identifier
	Err    error  // Set on error
}

// Contains the result of processing an Entry.
type EntryResult struct {
	EntryId string // Entry's identifier
	Err     error  // Set on error
}

type ProcessState struct {
	YDLPath string
	DumpDir string
	// Channel for Feed.Process goroutines to communicate to the
	// caller about the number of entries that are being
	// downloaded for a feed.
	FeedResultChan chan FeedResult
	// Number of feeds that are being processed.
	FeedsProcessing int
}

func NewProcessState() *ProcessState {
	ps := new(ProcessState)
	ps.FeedResultChan = make(chan FeedResult)
	return ps
}