feta/archiver.go

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
}