From ec9ff40e2e9d8b5bd89dc6017539d6500aaf3e4a Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 28 Nov 2021 20:34:33 -0500 Subject: add `state` package --- state/state.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 state/state.go 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 + +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 +} -- cgit v1.2.3