feta/archiver.go

40 lines
612 B
Go

package main
import (
"context"
"time"
//"github.com/bitly/go-simplejson"
)
type InstanceHostName string
type Archiver struct {
locator *InstanceLocator
instances map[InstanceHostName]*Instance
startup *time.Time
ctx context.Context
}
func NewArchiver(ctx context.Context) *Archiver {
a := new(Archiver)
a.ctx = ctx
return a
}
func (a *Archiver) Uptime() time.Duration {
return time.Since(*a.startup)
}
func (a *Archiver) RunForever() int {
t := time.Now()
a.startup = &t
a.locator = NewInstanceLocator()
go a.locator.Locate()
for {
time.Sleep(1 * time.Second)
}
return 0
}