Documentation
¶
Overview ¶
Package store pkg/deployment/ut/store/memory_store.go c4-net-discovery
Package store pkg/deployment/ut/store/postgres_store.go c4-net-discovery
Package store pkg/deployment/ut/store/store.go c4-net-discovery
Package store pkg/deployment/ut/store/uptime_response.go c4-net-discovery
Package store pkg/deployment/ut/store/visors_response.go c4-net-discovery
Index ¶
Constants ¶
const OnlineThreshold = time.Minute * 6
OnlineThreshold is a value used for uptime calculation.
const (
// UptimeSeconds is a time (in seconds) that for each update request from visor will added to its uptime value
UptimeSeconds = 300
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DailyUptimeHistory ¶
type DailyUptimeHistory struct {
ID uint `gorm:"primarykey" json:"-"`
CreatedAt time.Time
UpdatedAt time.Time
PubKey string
DailyOnline int
Version string
IPs string
LastIP string
}
DailyUptimeHistory is gorm.Model for daily uptime history table
type Store ¶
type Store interface {
GetAllUptimes(startYear int, startMonth time.Month, endYear int, endMonth time.Month) (UptimeResponse, error)
GetUptimes(pubKeys []string, startYear int, startMonth time.Month, endYear int, endMonth time.Month) (UptimeResponse, error)
GetAllVisors(locDetails geo.LocationDetails) (VisorsResponse, error)
GetVisorsIPs(month string) (map[string]visorIPsResponse, error)
GetNumberOfUptimesInCurrentMonth() (int, error)
GetNumberOfUptimesByYearAndMonth(year int, month time.Month) (int, error)
UpdateUptime(pk, ip, version string) error
GetDailyUpdateHistory() (map[string]map[string]string, error)
DeleteEntries([]DailyUptimeHistory) error
GetOldestEntry() (DailyUptimeHistory, error)
GetSpecificDayData(time time.Time) ([]DailyUptimeHistory, error)
Close()
}
Store is a wrapper for `UptimeStore`.
type UptimeDef ¶
type UptimeDef struct {
Key string `json:"key"`
Online bool `json:"online"`
Version string `json:"-"`
}
UptimeDef is the item of `UptimeResponse`.
type UptimeDefV2 ¶
type UptimeDefV2 struct {
Key string `json:"pk"`
Online bool `json:"on"`
Version string `json:"version,omitempty"`
DailyOnlineHistory map[string]string `json:"daily,omitempty"`
}
UptimeDefV2 is the item of `UptimeResponseV2`.
type UptimeResponse ¶
type UptimeResponse []UptimeDef
UptimeResponse is the tracker API response format for `/uptimes`.
type UptimeResponseV2 ¶
type UptimeResponseV2 []UptimeDefV2
UptimeResponseV2 is the tracker API response format v2 for `/uptimes`.
type VisorsResponse ¶
type VisorsResponse []VisorDef
VisorsResponse is the tracker API response format for `/visors`.