advisor

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advisor

type Advisor struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, wg *sync.WaitGroup, cfg *config.Advisory, nc *nats.Conn, tracker Tracker, inspectField string, stream string, replicator string, log *logrus.Entry) (*Advisor, error)

func (*Advisor) Pause

func (a *Advisor) Pause()

func (*Advisor) Resume

func (a *Advisor) Resume()

type AgeAdvisoryV2

type AgeAdvisoryV2 struct {
	Protocol     string    `json:"protocol"`
	EventID      string    `json:"event_id"`
	InspectField string    `json:"inspect_field"`
	Age          float64   `json:"age"`
	Seen         int64     `json:"seen"`
	Replicator   string    `json:"replicator"`
	Timestamp    int64     `json:"timestamp"`
	Event        EventType `json:"event"`
	Value        string    `json:"value"`
}

AgeAdvisoryV2 defines a message published when a node has not been seen within configured deadlines and when it recovers

type EventType

type EventType string

EventType is the kind of event that triggered the advisory

var (
	TimeoutEvent     EventType = "timeout"
	RecoverEvent     EventType = "recover"
	ExpireEvent      EventType = "expire"
	FirstSeenEvent   EventType = "new"
	AdvisoryProtocol           = "io.choria.sr.v2.age_advisory"
)

type Tracker

type Tracker interface {
	NotifyFirstSeen(cb func(string, idtrack.Item)) error
	NotifyRecover(cb func(string, idtrack.Item)) error
	NotifyAgeWarning(cb func(map[string]idtrack.Item)) error
	NotifyExpired(cb func(map[string]idtrack.Item)) error
	RecordAdvised(v string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL