Documentation ¶
Overview ¶
Package store implements how to output the log, and how to restore from the log file.
Index ¶
- Constants
- Variables
- type PathPattern
- func (p PathPattern) Build(t time.Time) string
- func (p PathPattern) Glob() string
- func (p PathPattern) IsEmpty() bool
- func (p PathPattern) ListAll() []string
- func (p PathPattern) ListBetween(since, until time.Time) []string
- func (p PathPattern) Match(filename string, since, until time.Time) bool
- func (p PathPattern) String() string
- 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) Pathes() []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) Targets() []string
Constants ¶
const ( PROBE_HISTORY_LEN = 60 INCIDENT_HISTORY_LEN = 20 )
Variables ¶
var (
LogRestoreBytes = int64(10 * 1024 * 1024)
)
Functions ¶
This section is empty.
Types ¶
type PathPattern ¶ added in v0.16.0
type PathPattern struct {
// contains filtered or unexported fields
}
func ParsePathPattern ¶ added in v0.16.0
func ParsePathPattern(s string) PathPattern
func (PathPattern) Glob ¶ added in v0.16.0
func (p PathPattern) Glob() string
func (PathPattern) IsEmpty ¶ added in v0.16.0
func (p PathPattern) IsEmpty() bool
func (PathPattern) ListAll ¶ added in v0.16.0
func (p PathPattern) ListAll() []string
ListAll returns all log file pathes. The result is sorted by time order.
func (PathPattern) ListBetween ¶ added in v0.16.0
func (p PathPattern) ListBetween(since, until time.Time) []string
ListBetween returns log file pathes. The result is filtered by since and until query, but not sorted.
func (PathPattern) Match ¶ added in v0.16.0
func (p PathPattern) Match(filename string, since, until time.Time) bool
func (PathPattern) String ¶ added in v0.16.0
func (p PathPattern) String() string
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.