summaryrefslogtreecommitdiffstats
path: root/state/state.go
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-11-28 20:34:33 -0500
committersiddharth <s@ricketyspace.net>2021-11-28 20:34:33 -0500
commitec9ff40e2e9d8b5bd89dc6017539d6500aaf3e4a (patch)
treebbc55e23a427bb72f161e62940d3972d45a2e6d7 /state/state.go
parentd85eb429a97cd66fddb34f81621b3238a71a6e6f (diff)
add `state` package
Diffstat (limited to 'state/state.go')
-rw-r--r--state/state.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/state/state.go b/state/state.go
new file mode 100644
index 0000000..8ad12e3
--- /dev/null
+++ b/state/state.go
@@ -0,0 +1,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
+}