35 lines
697 B
Go
35 lines
697 B
Go
package ingester
|
|
|
|
import "time"
|
|
import "github.com/rs/zerolog/log"
|
|
import "github.com/sneak/feta/toot"
|
|
import "github.com/sneak/feta/storage"
|
|
|
|
type TootIngester struct {
|
|
inbound chan *toot.Toot
|
|
recentlySeen []*seenTootMemo
|
|
storageBackend *storage.TootStorageBackend
|
|
}
|
|
|
|
type seenTootMemo struct {
|
|
lastSeen time.Time
|
|
tootHash toot.TootHash
|
|
}
|
|
|
|
func NewTootIngester() *TootIngester {
|
|
ti := new(TootIngester)
|
|
ti.inbound = make(chan *toot.Toot, 1)
|
|
return ti
|
|
}
|
|
|
|
func (ti *TootIngester) GetDeliveryChannel() chan *toot.Toot {
|
|
return ti.inbound
|
|
}
|
|
|
|
func (ti *TootIngester) Ingest() {
|
|
log.Info().Msg("TootIngester starting")
|
|
for {
|
|
time.Sleep(1 * time.Second) // FIXME do something
|
|
}
|
|
}
|