func Record(id string) {
	RecordTime(id, time.Now())
}
Record records the fact that a node was seen
package advisor
import (
	"context"
	"encoding/json"
	"fmt"
	"sync"
	"time"
	"github.com/choria-io/stream-replicator/backoff"
	"github.com/choria-io/stream-replicator/config"
	"github.com/choria-io/stream-replicator/connector"
	nats "github.com/nats-io/nats.go"
	"github.com/sirupsen/logrus"
)
type stream interface {
	Connect(ctx context.Context)
	Publish(subject string, data []byte) error
	Close() error
	NatsConn() *nats.Conn
}
type AgeAdvisoryV1 struct {
	Version    string    `json:"$schema"`
	Inspect    string    `json:"inspect"`
	Value      string    `json:"value"`
	Age        int64     `json:"age"`
	Seen       int64     `json:"seen"`
	Replicator string    `json:"replicator"`
	Timestamp  int64     `json:"timestamp"`
	Event      EventType `json:"event" validate:"enum=timeout,recover,expire"`
}
type EventType string
const (
	Timeout = EventType("timeout")
	Recovery = EventType("recover")
	Expired = EventType("expire")
)
var out chan AgeAdvisoryV1
var seen map[string]time.Time
var advised map[string]time.Time
var mu = &sync.Mutex{}
var configured = false
var conf *config.TopicConf
var interval time.Duration
var age time.Duration
var err error
var log *logrus.Entry
var conn stream
var natstls bool
var name string
func init() {
	reset()
}
func Configure(tls bool, c *config.TopicConf) error {
	mu.Lock()
	defer mu.Unlock()
	conf = c
	name = fmt.Sprintf("%s_advisor", c.Name)
	log = logrus.WithFields(logrus.Fields{"name": name})
	if conf.Advisory == nil {
		log.Warn("No advisory settings configured, disabling advisory publishing")
		return nil
	}
	natstls = tls
	age, err = time.ParseDuration(c.Advisory.Age)
	if err != nil {
		return fmt.Errorf("age cannot be parsed as a duration: %s", err)
	}
	interval, err = time.ParseDuration(c.MinAge)
	if err != nil {
		return fmt.Errorf("topic min age cannot be parsed as a duration: %s", err)
	}
	reset()
	configured = true
	return nil
}
func Connect(ctx context.Context, wg *sync.WaitGroup) {
	mu.Lock()
	defer mu.Unlock()
	if !configured {
		return
	}
	log.Debug("Starting advisor connection")
	connect(ctx)
	log.Debug("Starting advisor publisher")
	wg.Add(1)
	go publisher(ctx, wg)
	log.Debug("Starting advisor monitor")
	wg.Add(1)
	go monitor(ctx, wg)
}