package deadlinks import ( "fmt" "time" ) // ResourceStatus describes what state a particular Resource is in. type ResourceStatus int // Enumeration of ResourceStatus values. const ( ResourceStatusUnknown ResourceStatus = iota ResourceStatusOK ResourceStatusError ) func (ds ResourceStatus) String() string { switch ds { case ResourceStatusUnknown: return "UNKNOWN" case ResourceStatusOK: return "OK" case ResourceStatusError: return "ERROR" default: panic(fmt.Sprintf("unknown ResourceStatus: %#v", ds)) } } // Resource describes the current state of a resource, with the resource being // uniquely identified by a URL. type Resource struct { URL URL Status ResourceStatus `yaml:"-"` Pinned bool `yaml:"-"` LastChecked time.Time `yaml:"last_checked"` // only set if Status == ResourceStatusError ErrorString string `yaml:"error"` // Indicate the URLs of resources which link to/are linked from this // resource. IncomingLinkURLs []URL `yaml:"incoming_links"` OutgoingLinkURLs []URL `yaml:"outgoing_links"` }