Documentation
¶
Index ¶
- type DailyBalance
- type Deployment
- type EarningsRecord
- type FleetDevice
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteDeployment(slug string) error
- func (s *Store) DeleteFleetDevice(id int64) error
- func (s *Store) GetCredentials(slug string) (map[string]string, error)
- func (s *Store) GetDeployment(slug string) (Deployment, bool, error)
- func (s *Store) ListCredentialSlugs() []string
- func (s *Store) ListDailyBalances(daysBack int) []DailyBalance
- func (s *Store) ListDeployments() []Deployment
- func (s *Store) ListEarningsHistory(limit int) []EarningsRecord
- func (s *Store) ListFleetDevices() []FleetDevice
- func (s *Store) ListLatestEarnings() []EarningsRecord
- func (s *Store) RecordEvent(slug, event, detail string)
- func (s *Store) SaveCredentials(slug string, values map[string]string) error
- func (s *Store) SaveEarnings(record EarningsRecord) (EarningsRecord, error)
- func (s *Store) UpsertDeployment(dep Deployment) error
- func (s *Store) UpsertFleetDevice(device FleetDevice) (FleetDevice, error)
- func (s *Store) UpsertFleetHeartbeat(device FleetDevice) (FleetDevice, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DailyBalance ¶ added in v0.6.0
type Deployment ¶
type Deployment struct {
Slug string `json:"slug"`
ContainerID string `json:"containerId"`
Name string `json:"name"`
Image string `json:"image"`
Status string `json:"status"`
Runtime string `json:"runtime"`
CPUPercent float64 `json:"cpuPercent"`
MemoryMB float64 `json:"memoryMb"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type EarningsRecord ¶
type FleetDevice ¶ added in v0.6.0
type FleetDevice struct {
ID int64 `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Endpoint string `json:"endpoint"`
OS string `json:"os"`
Arch string `json:"arch"`
Status string `json:"status"`
Services []string `json:"services"`
LastSeen string `json:"lastSeen"`
CreatedAt string `json:"createdAt"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteDeployment ¶
func (*Store) DeleteFleetDevice ¶ added in v0.6.0
func (*Store) GetCredentials ¶
func (*Store) GetDeployment ¶
func (s *Store) GetDeployment(slug string) (Deployment, bool, error)
func (*Store) ListCredentialSlugs ¶ added in v0.7.0
ListCredentialSlugs returns the slug of every service that has saved credentials, ordered by slug. collectAll unions this with the deployment set so imageless supported services (which never create a deployment row) still participate in the scheduled collection cycle.
func (*Store) ListDailyBalances ¶ added in v0.6.0
func (s *Store) ListDailyBalances(daysBack int) []DailyBalance
ListDailyBalances returns the latest successful balance (rows whose error column is empty) for each (platform, day) over the last daysBack days. The latest row per (platform, day) is chosen by MAX(id), not MAX(created_at): created_at is stored as RFC3339Nano whose variable-length fraction makes a lexicographic MAX(created_at) mis-order same-second rows (e.g. "…:00Z" sorts AFTER "…:00.5Z" because 'Z' > '.'), so the monotonic AUTOINCREMENT id is the deterministic "last written wins" key.
func (*Store) ListDeployments ¶
func (s *Store) ListDeployments() []Deployment
func (*Store) ListEarningsHistory ¶ added in v0.5.0
func (s *Store) ListEarningsHistory(limit int) []EarningsRecord
func (*Store) ListFleetDevices ¶ added in v0.6.0
func (s *Store) ListFleetDevices() []FleetDevice
func (*Store) ListLatestEarnings ¶
func (s *Store) ListLatestEarnings() []EarningsRecord
ListLatestEarnings returns the most recently written row per platform, INCLUDING error rows (the dashboard breakdown and notifications rely on the latest row even when it failed). The latest row per platform is chosen by MAX(id), not MAX(created_at): created_at is RFC3339Nano whose variable-length fraction makes a lexicographic MAX(created_at) mis-order same-second rows (e.g. "…:00Z" sorts ABOVE "…:00.5Z" because 'Z' > '.'), so the monotonic AUTOINCREMENT id is the deterministic "last written wins" key — matching the shape ListDailyBalances already uses.
func (*Store) RecordEvent ¶
func (*Store) SaveCredentials ¶
func (*Store) SaveEarnings ¶
func (s *Store) SaveEarnings(record EarningsRecord) (EarningsRecord, error)
func (*Store) UpsertDeployment ¶
func (s *Store) UpsertDeployment(dep Deployment) error
func (*Store) UpsertFleetDevice ¶ added in v0.6.0
func (s *Store) UpsertFleetDevice(device FleetDevice) (FleetDevice, error)
func (*Store) UpsertFleetHeartbeat ¶ added in v0.6.0
func (s *Store) UpsertFleetHeartbeat(device FleetDevice) (FleetDevice, error)