Documentation
¶
Overview ¶
Package changelog serves Rivolt's release notes: the hand-written notes of each release, as published on its GitHub Release, for the /changelog page and the Atom feed.
The notes are the release body once a person has written it. The body the release starts with is a generated commit list marked AutoNotesMarker, and a release with that body is left out until the notes replace it.
Index ¶
Constants ¶
const ( // DefaultURL is the public releases list of the Rivolt repository. DefaultURL = "https://api.github.com/repos/apohor/rivolt/releases?per_page=30" // AutoNotesMarker starts a generated release body (release-notes.yml). AutoNotesMarker = "<!-- rivolt:auto-notes -->" )
Variables ¶
ErrUnavailable is returned when there is no copy to serve: none was ever fetched, and a fetch is running, has just failed, or fails now.
Functions ¶
Types ¶
type Release ¶
type Release struct {
Tag string `json:"tag"`
PublishedAt time.Time `json:"published_at"`
Title string `json:"title"`
BodyMD string `json:"body_md"`
URL string `json:"url"`
}
Release is one release's notes.
type Source ¶
type Source struct {
URL string
HTTP *http.Client
TTL time.Duration
Now func() time.Time
// contains filtered or unexported fields
}
Source fetches the releases from GitHub and keeps them for TTL. A failed refresh serves what it had. Safe for concurrent use.
func (*Source) Releases ¶
Releases returns the published releases with hand-written notes, newest first. It refreshes from GitHub when the copy is older than TTL. At most one refresh runs at a time, and none for failureBackoff after a failed one; meanwhile callers get the copy, or ErrUnavailable when there is none. So GitHub sees at most one request per TTL, or per backoff while it is failing, however many clients ask.