store

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

store package implements how to output the log, and how to restore from the log file.

Index

Constants

View Source
const (
	PROBE_HISTORY_LEN    = 40
	INCIDENT_HISTORY_LEN = 10
)

Variables

View Source
var (
	LogRestoreBytes int64 = 100 * 1024 * 1024
)

Functions

func CompareRecords

func CompareRecords(x, y api.Record) bool

func IncidentIsContinued

func IncidentIsContinued(i *api.Incident, r api.Record) bool

func NewIncident

func NewIncident(r api.Record) *api.Incident

Types

type IncidentHandler

type IncidentHandler func(*api.Incident)

type ProbeHistory

type ProbeHistory struct {
	Target  *url.URL
	Records []api.Record
	// contains filtered or unexported fields
}

func (ProbeHistory) MakeReport

func (ph ProbeHistory) MakeReport() api.ProbeHistory

type ProbeHistoryMap

type ProbeHistoryMap map[string]*ProbeHistory

func (ProbeHistoryMap) Append

func (hs ProbeHistoryMap) Append(r api.Record)

type Store

type Store struct {
	Path string

	Console io.Writer

	OnIncident    []IncidentHandler
	IncidentCount int
	// contains filtered or unexported fields
}

func New

func New(path string, console io.Writer) (*Store, error)

func (*Store) AddTarget

func (s *Store) AddTarget(target *url.URL)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CurrentIncidents

func (s *Store) CurrentIncidents() []*api.Incident

func (*Store) Errors added in v0.11.0

func (s *Store) Errors() (healthy bool, messages []string)

Errors returns store status and error logs.

func (*Store) IncidentHistory

func (s *Store) IncidentHistory() []*api.Incident

func (*Store) MakeReport

func (s *Store) MakeReport() api.Report

func (*Store) ProbeHistory

func (s *Store) ProbeHistory() []*ProbeHistory

func (*Store) Report

func (s *Store) Report(r api.Record)

func (*Store) ReportInternalError

func (s *Store) ReportInternalError(scope, message string)

func (*Store) Restore

func (s *Store) Restore() error

Jump to

Keyboard shortcuts

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