Documentation
¶
Overview ¶
Package store implements how to output the log, and how to restore from the log file.
Index ¶
- Constants
- Variables
- type RecordHandler
- type Store
- func (s *Store) ActivateTarget(source, target *api.URL)
- func (s *Store) Close() error
- func (s *Store) CurrentIncidents() []*api.Incident
- func (s *Store) DeactivateTarget(source *api.URL, targets ...*api.URL)
- func (s *Store) Errors() (healthy bool, messages []string)
- func (s *Store) IncidentCount() int
- func (s *Store) IncidentHistory() []*api.Incident
- func (s *Store) MakeReport(probeHistoryLength int) api.Report
- func (s *Store) OpenLog(since, until time.Time) (api.LogScanner, error)
- func (s *Store) Path() string
- func (s *Store) ProbeHistory() []api.ProbeHistory
- func (s *Store) Report(source *api.URL, r api.Record)
- func (s *Store) ReportInternalError(scope, message string)
- func (s *Store) Restore() error
- func (s *Store) SetIndexInterval(interval int64)
- func (s *Store) Targets() []string
Constants ¶
const ( PROBE_HISTORY_LEN = 60 INCIDENT_HISTORY_LEN = 20 )
Variables ¶
var ( // ErrLogUnmatch is an error causes when the log index can't be used because log file has updated. ErrLogUnmatch = errors.New("error: log is unmatch to the index") )
var (
LogRestoreBytes int64 = 1024 * 1024 * 1024
)
Functions ¶
This section is empty.
Types ¶
type RecordHandler ¶ added in v0.12.0
type Store ¶
type Store struct {
Console io.Writer
OnStatusChanged []RecordHandler
// contains filtered or unexported fields
}
Store is the log handler of Ayd, and it also the database of Ayd.
func (*Store) ActivateTarget ¶ added in v0.12.0
ActivateTarget marks the target will reported via specified source. This method prepares a probeHistory, and mark it as active.
func (*Store) CurrentIncidents ¶
func (*Store) DeactivateTarget ¶ added in v0.12.0
DeactivateTarget marks the target is no longer reported via specified source.
func (*Store) IncidentCount ¶
IncidentCount returns the count of incident causes.
func (*Store) IncidentHistory ¶
func (*Store) MakeReport ¶
MakeReport creates ayd.Report for exporting for endpoint. The result includes only information about active targets.
func (*Store) ProbeHistory ¶
func (s *Store) ProbeHistory() []api.ProbeHistory
ProbeHistory returns a slice of lib-ayd.ProbeHistory. This method only returns active target's ProbeHistory.
func (*Store) Report ¶
Report reports a Record to this Store.
See also probeHistoryMap.Append about the arguments.
func (*Store) ReportInternalError ¶
func (*Store) SetIndexInterval ¶ added in v0.15.1
SetIndexInterval sets indexing interval for debug.