Documentation ¶
Overview ¶
Package cache implements accessing of the state.yml file.
Index ¶
Constants ¶
View Source
const FileName = "state.yml"
FileName denotes the name of the cache file.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache interface { // Dirty reports whether the cache has been mutated since being loaded // or initialized. Dirty() bool // Channel reports the release channel the cache is subscribed to. Channel() string // SetChannel sets the channel to the one corresponding to the given // string. It reports the value the channel was actually set to. // // Calling SetChannel on a Cache set to a different channel, zeroes out // the Cache's release & timestamp information. SetChannel(string) string // LastCheckedAt reports the last time SetLatestRelease with a non-nil // value was called on the Cache. LastCheckedAt() time.Time // LatestRelease reports the latest release the cache is aware of. LatestRelease() *update.Release // SetLatestRelease sets the latest release for the given channel. // // Calling SetLatestRelease for a different channel than the one the Cache // is set to has no effect. SetLatestRelease(channel string, r *update.Release) // Save writes the YAML-encoded representation of c to the named file path via // os.WriteFile. Save(path string) error }
Cache wraps the functionality of the local cache file.
func FromContext ¶
FromContext returns the Cache ctx carries. It panics in case ctx carries no Cache.
Click to show internal directories.
Click to hide internal directories.