internal: Annotate all components with groups
This commit ensures that the compiler has to check every component against the groups they implement by explicitly annotating the appropriate interfaces.
This commit is contained in:
parent
3455f491ca
commit
890022ae64
29 changed files with 163 additions and 33 deletions
|
|
@ -45,6 +45,10 @@ type LastCronFetcher struct {
|
|||
Drush *Drush
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*LastCronFetcher)(nil)
|
||||
)
|
||||
|
||||
func (lbr *LastCronFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
|
||||
if flags.Quick {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ type LastUpdateFetcher struct {
|
|||
Drush *Drush
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*LastUpdateFetcher)(nil)
|
||||
)
|
||||
|
||||
func (lbr *LastUpdateFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
|
||||
info.LastUpdate, err = lbr.Drush.LastUpdate(flags.Context)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ type RunningFetcher struct {
|
|||
Barrel *Barrel
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*RunningFetcher)(nil)
|
||||
)
|
||||
|
||||
func (rf *RunningFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
|
||||
info.Running, err = rf.Barrel.Running(flags.Context)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ type SSH struct {
|
|||
Barrel *barrel.Barrel
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*SSH)(nil)
|
||||
)
|
||||
|
||||
func (ssh *SSH) Keys() ([]ssh.PublicKey, error) {
|
||||
file, err := ssh.Environment.Open(ssh.Barrel.AuthorizedKeysPath())
|
||||
if environment.IsNotExist(err) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ type Info struct {
|
|||
Analytics *lazy.PoolAnalytics
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*Info)(nil)
|
||||
)
|
||||
|
||||
// Information fetches information about this WissKI.
|
||||
// TODO: Rework this to be able to determine what kind of information is available.
|
||||
func (wisski *Info) Information(ctx context.Context, quick bool) (info status.WissKI, err error) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ type SnapshotsFetcher struct {
|
|||
Info *Info
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*SnapshotsFetcher)(nil)
|
||||
)
|
||||
|
||||
func (lbr *SnapshotsFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
|
||||
if flags.Quick {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ type Locker struct {
|
|||
ingredient.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ = (ingredient.WissKIFetcher)((*Locker)(nil))
|
||||
)
|
||||
|
||||
var Locked = exit.Error{
|
||||
Message: "WissKI Instance is locked for administrative operations",
|
||||
ExitCode: exit.ExitGeneric,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ type Pathbuilder struct {
|
|||
PHP *php.PHP
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*Pathbuilder)(nil)
|
||||
)
|
||||
|
||||
//go:embed pathbuilder.php
|
||||
var pathbuilderPHP string
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ type Prefixes struct {
|
|||
MStore *mstore.MStore
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*Prefixes)(nil)
|
||||
)
|
||||
|
||||
// NoPrefix checks if this WissKI instance is excluded from generating prefixes.
|
||||
// TODO: Move this to the database!
|
||||
func (prefixes *Prefixes) NoPrefix() bool {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ type Stats struct {
|
|||
PHP *php.PHP
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*Stats)(nil)
|
||||
)
|
||||
|
||||
//go:embed stats.php
|
||||
var statsPHP string
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ type Users struct {
|
|||
PHP *php.PHP
|
||||
}
|
||||
|
||||
var (
|
||||
_ ingredient.WissKIFetcher = (*Users)(nil)
|
||||
)
|
||||
|
||||
//go:embed users.php
|
||||
var usersPHP string
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue