24 lines
495 B
Go
24 lines
495 B
Go
package upstream
|
|
|
|
type FetchClass string
|
|
|
|
const (
|
|
FetchValid FetchClass = "valid"
|
|
FetchEmpty FetchClass = "empty"
|
|
FetchDuplicateOnly FetchClass = "duplicate_only"
|
|
FetchError FetchClass = "error"
|
|
)
|
|
|
|
func ClassifyFetchResult(callErr, parseErr error, validCount, newCount int) FetchClass {
|
|
if callErr != nil || parseErr != nil {
|
|
return FetchError
|
|
}
|
|
if validCount <= 0 {
|
|
return FetchEmpty
|
|
}
|
|
if newCount <= 0 {
|
|
return FetchDuplicateOnly
|
|
}
|
|
return FetchValid
|
|
}
|