component/dis: Check if instance alive

This commit is contained in:
Tom Wiesing 2022-09-15 18:11:19 +02:00
parent 37cdd201f0
commit 492a0c0404
No known key found for this signature in database
8 changed files with 145 additions and 22 deletions

View file

@ -0,0 +1,22 @@
package instances
import "github.com/tkw1536/goprogram/stream"
// Info represents some info about this WissKI
type Info struct {
Slug string // The slug of the instance
Running bool // is the instance running?
}
// Info returns info about this instance
func (wisski *WissKI) Info() (info Info, err error) {
info.Slug = wisski.Slug
ps, err := wisski.Barrel().Ps(stream.FromNil())
if err != nil {
return
}
info.Running = len(ps) > 0
return
}