feta/archiver.go
2019-11-01 23:56:17 -07:00

34 lines
525 B
Go

package main
import "time"
type InstanceHostName string
type TootArchiver struct {
locator *InstanceLocator
instances map[InstanceHostName]*Instance
startup *time.Time
}
func NewTootArchiver() *TootArchiver {
a := new(TootArchiver)
return a
}
func (a *TootArchiver) Uptime() time.Duration {
return time.Since(*a.startup)
}
func (a *TootArchiver) RunForever() int {
t := time.Now()
a.startup = &t
a.locator = NewInstanceLocator()
go a.locator.Locate()
for {
time.Sleep(1 * time.Second)
}
return 0
}