status: Rename Information => WissKI

This commit is contained in:
Tom Wiesing 2022-11-18 08:41:42 +01:00
parent 3fada6ad38
commit 57f2fe8c86
No known key found for this signature in database
16 changed files with 21 additions and 21 deletions

View file

@ -65,7 +65,7 @@ func (home *Home) homeRender() ([]byte, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
context.Instances = make([]status.Information, len(wissKIs)) context.Instances = make([]status.WissKI, len(wissKIs))
// determine their infos // determine their infos
var eg errgroup.Group var eg errgroup.Group
@ -86,7 +86,7 @@ func (home *Home) homeRender() ([]byte, error) {
} }
type HomeContext struct { type HomeContext struct {
Instances []status.Information Instances []status.WissKI
Time time.Time Time time.Time

View file

@ -21,7 +21,7 @@ var indexTemplate = static.AssetsControlIndex.MustParseShared(
type indexContext struct { type indexContext struct {
status.Distillery status.Distillery
Instances []status.Information Instances []status.WissKI
} }
func (info *Info) index(r *http.Request) (idx indexContext, err error) { func (info *Info) index(r *http.Request) (idx indexContext, err error) {
@ -31,7 +31,7 @@ func (info *Info) index(r *http.Request) (idx indexContext, err error) {
// Status produces a new observation of the distillery, and a new information of all instances // Status produces a new observation of the distillery, and a new information of all instances
// The information on all instances is passed the given quick flag. // The information on all instances is passed the given quick flag.
func (info *Info) Status(QuickInformation bool) (target status.Distillery, information []status.Information, err error) { func (info *Info) Status(QuickInformation bool) (target status.Distillery, information []status.WissKI, err error) {
var group errgroup.Group var group errgroup.Group
group.Go(func() error { group.Go(func() error {
@ -42,7 +42,7 @@ func (info *Info) Status(QuickInformation bool) (target status.Distillery, infor
} }
// get all of their info! // get all of their info!
information = make([]status.Information, len(all)) information = make([]status.WissKI, len(all))
for i, instance := range all { for i, instance := range all {
{ {
i := i i := i

View file

@ -24,7 +24,7 @@ type instanceContext struct {
Time time.Time Time time.Time
Instance models.Instance Instance models.Instance
Info status.Information Info status.WissKI
} }
func (info *Info) instance(r *http.Request) (is instanceContext, err error) { func (info *Info) instance(r *http.Request) (is instanceContext, err error) {

View file

@ -8,8 +8,8 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/phpx" "github.com/FAU-CDI/wisski-distillery/internal/phpx"
) )
// Information provides information about a single WissKI // WissKI provides information about a single WissKI
type Information struct { type WissKI struct {
Time time.Time // Time this info was built Time time.Time // Time this info was built
Slug string // slug Slug string // slug

View file

@ -70,7 +70,7 @@ type LastRebuildFetcher struct {
Barrel *Barrel Barrel *Barrel
} }
func (lbr *LastRebuildFetcher) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (lbr *LastRebuildFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.LastRebuild, _ = lbr.Barrel.LastRebuild() info.LastRebuild, _ = lbr.Barrel.LastRebuild()
return return
} }

View file

@ -44,7 +44,7 @@ type LastCronFetcher struct {
Drush *Drush Drush *Drush
} }
func (lbr *LastCronFetcher) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (lbr *LastCronFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
if flags.Quick { if flags.Quick {
return return
} }

View file

@ -55,7 +55,7 @@ type LastUpdateFetcher struct {
Drush *Drush Drush *Drush
} }
func (lbr *LastUpdateFetcher) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (lbr *LastUpdateFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.LastUpdate, err = lbr.Drush.LastUpdate() info.LastUpdate, err = lbr.Drush.LastUpdate()
return return
} }

View file

@ -21,7 +21,7 @@ type RunningFetcher struct {
Barrel *Barrel Barrel *Barrel
} }
func (rf *RunningFetcher) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (rf *RunningFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.Running, err = rf.Barrel.Running() info.Running, err = rf.Barrel.Running()
return return
} }

View file

@ -33,7 +33,7 @@ func (ssh *SSH) Keys() ([]ssh.PublicKey, error) {
return sshx.ParseAllKeys(bytes), nil return sshx.ParseAllKeys(bytes), nil
} }
func (sshx *SSH) Fetch(flags ingredient.FetcherFlags, info *status.Information) error { func (sshx *SSH) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) error {
if flags.Quick { if flags.Quick {
return nil return nil
} }

View file

@ -10,7 +10,7 @@ type WissKIFetcher interface {
// Fetch fetches information from this ingredient and writes it into target. // Fetch fetches information from this ingredient and writes it into target.
// Distinct WissKIFetchers must write into distinct fields. // Distinct WissKIFetchers must write into distinct fields.
Fetch(flags FetcherFlags, target *status.Information) error Fetch(flags FetcherFlags, target *status.WissKI) error
} }
// FetcherFlags describes options for a WissKIFetcher // FetcherFlags describes options for a WissKIFetcher

View file

@ -21,7 +21,7 @@ type Info struct {
// Information fetches information about this WissKI. // Information fetches information about this WissKI.
// TODO: Rework this to be able to determine what kind of information is available. // TODO: Rework this to be able to determine what kind of information is available.
func (wisski *Info) Information(quick bool) (info status.Information, err error) { func (wisski *Info) Information(quick bool) (info status.WissKI, err error) {
// setup flags // setup flags
flags := ingredient.FetcherFlags{ flags := ingredient.FetcherFlags{
Quick: quick, Quick: quick,
@ -48,7 +48,7 @@ func (wisski *Info) Information(quick bool) (info status.Information, err error)
return return
} }
func (wisski *Info) Fetch(flags ingredient.FetcherFlags, info *status.Information) error { func (wisski *Info) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) error {
info.Time = time.Now().UTC() info.Time = time.Now().UTC()
info.Slug = wisski.Slug info.Slug = wisski.Slug
info.URL = wisski.URL().String() info.URL = wisski.URL().String()

View file

@ -11,7 +11,7 @@ type SnapshotsFetcher struct {
Info *Info Info *Info
} }
func (lbr *SnapshotsFetcher) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (lbr *SnapshotsFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
if flags.Quick { if flags.Quick {
return return
} }

View file

@ -18,7 +18,7 @@ func (lock *Locker) Locked() (locked bool) {
return return
} }
func (locker *Locker) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (locker *Locker) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.Locked = locker.Locked() info.Locked = locker.Locked()
return return
} }

View file

@ -45,7 +45,7 @@ func (pathbuilder *Pathbuilder) GetAll(server *phpx.Server) (pathbuilders map[st
return return
} }
func (pathbuilder *Pathbuilder) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (pathbuilder *Pathbuilder) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
if flags.Quick { if flags.Quick {
return return
} }

View file

@ -156,7 +156,7 @@ func (wisski *Prefixes) Update() error {
return prefix.SetAll(wisski.MStore, prefixes...) return prefix.SetAll(wisski.MStore, prefixes...)
} }
func (prefixes *Prefixes) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (prefixes *Prefixes) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
info.NoPrefixes = prefixes.NoPrefix() info.NoPrefixes = prefixes.NoPrefix()
if flags.Quick { if flags.Quick {
// quick mode: grab only the cached prefixes // quick mode: grab only the cached prefixes

View file

@ -28,7 +28,7 @@ func (stats *Stats) Get(server *phpx.Server) (data status.Statistics, err error)
return return
} }
func (stats *Stats) Fetch(flags ingredient.FetcherFlags, info *status.Information) (err error) { func (stats *Stats) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
if flags.Quick { if flags.Quick {
return return
} }