Documentation
¶
Index ¶
- func Migrate(db *sql.DB, logger *slog.Logger) error
- func NullableString(s string) interface{}
- func StartRetentionCleanupWithOpts(ctx context.Context, store *ContainerStore, db *DB, logger *slog.Logger, ...)
- type AcknowledgmentStoreImpl
- func (s *AcknowledgmentStoreImpl) DeleteAcknowledgment(ctx context.Context, id string) error
- func (s *AcknowledgmentStoreImpl) GetAcknowledgment(ctx context.Context, id string) (*security.RiskAcknowledgment, error)
- func (s *AcknowledgmentStoreImpl) InsertAcknowledgment(ctx context.Context, ack *security.RiskAcknowledgment) (string, error)
- func (s *AcknowledgmentStoreImpl) IsAcknowledged(ctx context.Context, containerExternalID, findingType, findingKey string) (bool, error)
- func (s *AcknowledgmentStoreImpl) ListAcknowledgments(ctx context.Context, containerExternalID string) ([]*security.RiskAcknowledgment, error)
- type AgentStore
- func (s *AgentStore) CountByRuntime(ctx context.Context) (docker, swarm, kubernetes int, err error)
- func (s *AgentStore) CountByStatus(ctx context.Context) (active, revoked int, err error)
- func (s *AgentStore) Delete(ctx context.Context, agentID string) error
- func (s *AgentStore) DeleteToken(ctx context.Context, tokenID string) error
- func (s *AgentStore) EnrollAtomic(ctx context.Context, limit int, tokenCleartext string, a *agent.Agent) error
- func (s *AgentStore) GcExpiredTokens(ctx context.Context) error
- func (s *AgentStore) Get(ctx context.Context, agentID string) (*agent.Agent, error)
- func (s *AgentStore) GetByToken(ctx context.Context, tokenCleartext string) (*agent.EnrollmentToken, error)
- func (s *AgentStore) GetTokenByID(ctx context.Context, tokenID string) (*agent.EnrollmentToken, error)
- func (s *AgentStore) Insert(ctx context.Context, a *agent.Agent) error
- func (s *AgentStore) InsertToken(ctx context.Context, t *agent.EnrollmentToken) error
- func (s *AgentStore) List(ctx context.Context, statusFilter string) ([]*agent.Agent, error)
- func (s *AgentStore) ListTokens(ctx context.Context, includeExpired, includeConsumed bool) ([]*agent.EnrollmentToken, error)
- func (s *AgentStore) Revoke(ctx context.Context, agentID, revokedBy string) error
- func (s *AgentStore) StaleAgents(ctx context.Context, threshold time.Duration) ([]string, error)
- func (s *AgentStore) UpdateLabel(ctx context.Context, agentID, label string) error
- func (s *AgentStore) UpdateLastSeen(ctx context.Context, agentID string, t time.Time) error
- type AlertStoreImpl
- func (s *AlertStoreImpl) AcknowledgeAlert(ctx context.Context, id string, by string, at time.Time) error
- func (s *AlertStoreImpl) DeleteAlertsOlderThan(ctx context.Context, before time.Time) (int64, error)
- func (s *AlertStoreImpl) GetActiveAlert(ctx context.Context, source, alertType, entityType string, entityID string) (*alert.Alert, error)
- func (s *AlertStoreImpl) GetAlert(ctx context.Context, id string) (*alert.Alert, error)
- func (s *AlertStoreImpl) InsertAlert(ctx context.Context, a *alert.Alert) (string, error)
- func (s *AlertStoreImpl) ListActiveAlerts(ctx context.Context) ([]*alert.Alert, error)
- func (s *AlertStoreImpl) ListAlerts(ctx context.Context, opts alert.ListAlertsOpts) ([]*alert.Alert, error)
- func (s *AlertStoreImpl) ListUnacknowledgedActiveAlerts(ctx context.Context) ([]*alert.Alert, error)
- func (s *AlertStoreImpl) SetEscalatedAt(ctx context.Context, id string, at time.Time) error
- func (s *AlertStoreImpl) UpdateAlertOnEscalation(ctx context.Context, id, severity, message, entityName, details string) error
- func (s *AlertStoreImpl) UpdateAlertStatus(ctx context.Context, id string, status string, resolvedAt *time.Time, ...) error
- type CertificateStore
- func (s *CertificateStore) CountConfigured(ctx context.Context) (int, error)
- func (s *CertificateStore) CountStandaloneMonitors(ctx context.Context) (int, error)
- func (s *CertificateStore) CreateMonitor(ctx context.Context, m *certificate.CertMonitor) (string, error)
- func (s *CertificateStore) DeleteCheckResultsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *CertificateStore) DeleteMonitor(ctx context.Context, id string) error
- func (s *CertificateStore) GetChainEntries(ctx context.Context, checkResultID string) ([]*certificate.CertChainEntry, error)
- func (s *CertificateStore) GetLatestCheckResult(ctx context.Context, monitorID string) (*certificate.CertCheckResult, error)
- func (s *CertificateStore) GetMonitorByEndpointID(ctx context.Context, endpointID string) (*certificate.CertMonitor, error)
- func (s *CertificateStore) GetMonitorByHostPort(ctx context.Context, hostname string, port int, serverName string) (*certificate.CertMonitor, error)
- func (s *CertificateStore) GetMonitorByHostPortAgent(ctx context.Context, agentID *string, hostname string, port int, ...) (*certificate.CertMonitor, error)
- func (s *CertificateStore) GetMonitorByID(ctx context.Context, id string) (*certificate.CertMonitor, error)
- func (s *CertificateStore) InsertChainEntries(ctx context.Context, entries []*certificate.CertChainEntry) error
- func (s *CertificateStore) InsertCheckResult(ctx context.Context, result *certificate.CertCheckResult) (string, error)
- func (s *CertificateStore) ListCheckResults(ctx context.Context, monitorID string, opts certificate.ListChecksOpts) ([]*certificate.CertCheckResult, int, error)
- func (s *CertificateStore) ListDueScheduledMonitors(ctx context.Context, now time.Time) ([]*certificate.CertMonitor, error)
- func (s *CertificateStore) ListMonitors(ctx context.Context, opts certificate.ListCertificatesOpts) ([]*certificate.CertMonitor, error)
- func (s *CertificateStore) ListMonitorsByExternalID(ctx context.Context, externalID string) ([]*certificate.CertMonitor, error)
- func (s *CertificateStore) UpdateMonitor(ctx context.Context, m *certificate.CertMonitor) error
- type ChannelStoreImpl
- func (s *ChannelStoreImpl) DeleteChannel(ctx context.Context, id string) error
- func (s *ChannelStoreImpl) GetChannel(ctx context.Context, id string) (*alert.NotificationChannel, error)
- func (s *ChannelStoreImpl) GetChannelHealth(ctx context.Context, channelID string) (string, error)
- func (s *ChannelStoreImpl) InsertChannel(ctx context.Context, ch *alert.NotificationChannel) (string, error)
- func (s *ChannelStoreImpl) InsertDelivery(ctx context.Context, d *alert.NotificationDelivery) (string, error)
- func (s *ChannelStoreImpl) ListChannels(ctx context.Context) ([]*alert.NotificationChannel, error)
- func (s *ChannelStoreImpl) ListDeliveriesByAlert(ctx context.Context, alertID string) ([]*alert.NotificationDelivery, error)
- func (s *ChannelStoreImpl) UpdateChannel(ctx context.Context, ch *alert.NotificationChannel) error
- func (s *ChannelStoreImpl) UpdateDelivery(ctx context.Context, d *alert.NotificationDelivery) error
- type ContainerStore
- func (s *ContainerStore) ArchiveContainer(ctx context.Context, externalID string, archivedAt time.Time) error
- func (s *ContainerStore) CountConfigured(ctx context.Context) (int, error)
- func (s *ContainerStore) CountRestartsSince(ctx context.Context, containerID string, since time.Time) (int, error)
- func (s *ContainerStore) DeleteArchivedContainersBefore(ctx context.Context, before time.Time) (int64, error)
- func (s *ContainerStore) DeleteContainerByID(ctx context.Context, id string) error
- func (s *ContainerStore) DeleteTransitionsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *ContainerStore) GetContainerByExternalID(ctx context.Context, externalID string) (*container.Container, error)
- func (s *ContainerStore) GetContainerByID(ctx context.Context, id string) (*container.Container, error)
- func (s *ContainerStore) GetTransitionsInWindow(ctx context.Context, containerID string, from, to time.Time) ([]*container.StateTransition, error)
- func (s *ContainerStore) InsertContainer(ctx context.Context, c *container.Container) (string, error)
- func (s *ContainerStore) InsertTransition(ctx context.Context, t *container.StateTransition) (string, error)
- func (s *ContainerStore) ListContainers(ctx context.Context, opts container.ListContainersOpts) ([]*container.Container, error)
- func (s *ContainerStore) ListTransitionsByContainer(ctx context.Context, containerID string, opts container.ListTransitionsOpts) ([]*container.StateTransition, int, error)
- func (s *ContainerStore) UpdateContainer(ctx context.Context, c *container.Container) error
- type DB
- type DailyUptime
- type EndpointStore
- func (s *EndpointStore) CountActiveEndpoints(ctx context.Context) (int, error)
- func (s *EndpointStore) CountConfigured(ctx context.Context) (int, error)
- func (s *EndpointStore) DeactivateEndpoint(ctx context.Context, id string) error
- func (s *EndpointStore) DeleteCheckResultsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *EndpointStore) DeleteInactiveEndpointsBefore(ctx context.Context, before time.Time) (int64, error)
- func (s *EndpointStore) DeleteStandaloneEndpoint(ctx context.Context, id string) error
- func (s *EndpointStore) GetActiveAgentEndpointByTarget(ctx context.Context, agentID, target string) (*endpoint.Endpoint, error)
- func (s *EndpointStore) GetCheckResultsInWindow(ctx context.Context, endpointID string, from, to time.Time) (int, int, error)
- func (s *EndpointStore) GetEndpointByID(ctx context.Context, id string) (*endpoint.Endpoint, error)
- func (s *EndpointStore) GetEndpointByIdentity(ctx context.Context, containerName, labelKey string) (*endpoint.Endpoint, error)
- func (s *EndpointStore) GetSparklineData(ctx context.Context, limit int) (map[string][]float64, error)
- func (s *EndpointStore) InsertCheckResult(ctx context.Context, result *endpoint.CheckResult) (string, error)
- func (s *EndpointStore) InsertStandaloneEndpoint(ctx context.Context, e *endpoint.Endpoint) (string, error)
- func (s *EndpointStore) ListCheckResults(ctx context.Context, endpointID string, opts endpoint.ListChecksOpts) ([]*endpoint.CheckResult, int, error)
- func (s *EndpointStore) ListEndpoints(ctx context.Context, opts endpoint.ListEndpointsOpts) ([]*endpoint.Endpoint, error)
- func (s *EndpointStore) ListEndpointsByExternalID(ctx context.Context, externalID string) ([]*endpoint.Endpoint, error)
- func (s *EndpointStore) UpdateCheckResult(ctx context.Context, id string, status endpoint.EndpointStatus, ...) error
- func (s *EndpointStore) UpdateStandaloneEndpoint(ctx context.Context, id string, name, target string, ...) error
- func (s *EndpointStore) UpsertEndpoint(ctx context.Context, e *endpoint.Endpoint) (string, error)
- type EscalationStore
- func (s *EscalationStore) BulkDeactivateAllPolicies(ctx context.Context) error
- func (s *EscalationStore) BulkRestorePoliciesFromDowngrade(ctx context.Context) error
- func (s *EscalationStore) BulkStopActiveRuns(ctx context.Context, stopStatus string, endedAt time.Time) error
- func (s *EscalationStore) CountActivePolicies(ctx context.Context) (int, error)
- func (s *EscalationStore) DeletePolicy(ctx context.Context, id string) error
- func (s *EscalationStore) InsertDelivery(ctx context.Context, d *escalation.Delivery) (string, error)
- func (s *EscalationStore) InsertPolicy(ctx context.Context, p *escalation.Policy) (string, error)
- func (s *EscalationStore) InsertRun(ctx context.Context, r *escalation.Run) (string, error)
- func (s *EscalationStore) PauseRunForMaintenance(ctx context.Context, runID string, recheckAt time.Time) error
- func (s *EscalationStore) PurgeRunsAndDeliveriesOlderThan(ctx context.Context, before time.Time) error
- func (s *EscalationStore) ResumeRunFromMaintenance(ctx context.Context, runID string, nextActionAt time.Time) error
- func (s *EscalationStore) SelectActiveRunsByAlert(ctx context.Context, alertID string) ([]*escalation.Run, error)
- func (s *EscalationStore) SelectDueRuns(ctx context.Context, now time.Time) ([]*escalation.Run, error)
- func (s *EscalationStore) SelectOrphanPendingDeliveries(ctx context.Context, before time.Time) ([]*escalation.Delivery, error)
- func (s *EscalationStore) SelectPolicies(ctx context.Context, activeOnly bool) ([]*escalation.Policy, error)
- func (s *EscalationStore) SelectPolicy(ctx context.Context, id string) (*escalation.Policy, error)
- func (s *EscalationStore) SelectRun(ctx context.Context, id string) (*escalation.Run, error)
- func (s *EscalationStore) SelectRunDeliveries(ctx context.Context, runID string) ([]*escalation.Delivery, error)
- func (s *EscalationStore) SelectRunsByAlert(ctx context.Context, alertID string) ([]*escalation.Run, error)
- func (s *EscalationStore) SelectRunsByPolicy(ctx context.Context, policyID string, limit int, cursor string) ([]*escalation.Run, error)
- func (s *EscalationStore) TerminateRun(ctx context.Context, runID string, status string, endedAt time.Time) error
- func (s *EscalationStore) UpdateDelivery(ctx context.Context, d *escalation.Delivery) error
- func (s *EscalationStore) UpdatePolicy(ctx context.Context, p *escalation.Policy) error
- func (s *EscalationStore) UpdateRunProgress(ctx context.Context, runID string, lastExecutedLevelIndex int, ...) error
- type HeartbeatStore
- func (s *HeartbeatStore) CountActiveHeartbeats(ctx context.Context) (int, error)
- func (s *HeartbeatStore) CountConfigured(ctx context.Context) (int, error)
- func (s *HeartbeatStore) CreateHeartbeat(ctx context.Context, h *heartbeat.Heartbeat) (string, error)
- func (s *HeartbeatStore) DeleteExecutionsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *HeartbeatStore) DeleteHeartbeat(ctx context.Context, id string) error
- func (s *HeartbeatStore) DeletePingsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *HeartbeatStore) GetCurrentExecution(ctx context.Context, heartbeatID string) (*heartbeat.HeartbeatExecution, error)
- func (s *HeartbeatStore) GetHeartbeatByID(ctx context.Context, id string) (*heartbeat.Heartbeat, error)
- func (s *HeartbeatStore) GetHeartbeatByUUID(ctx context.Context, token string) (*heartbeat.Heartbeat, error)
- func (s *HeartbeatStore) InsertExecution(ctx context.Context, e *heartbeat.HeartbeatExecution) (string, error)
- func (s *HeartbeatStore) InsertPing(ctx context.Context, p *heartbeat.HeartbeatPing) (string, error)
- func (s *HeartbeatStore) ListExecutions(ctx context.Context, heartbeatID string, opts heartbeat.ListExecutionsOpts) ([]*heartbeat.HeartbeatExecution, int, error)
- func (s *HeartbeatStore) ListHeartbeats(ctx context.Context, opts heartbeat.ListHeartbeatsOpts) ([]*heartbeat.Heartbeat, error)
- func (s *HeartbeatStore) ListOverdueHeartbeats(ctx context.Context, now time.Time) ([]*heartbeat.Heartbeat, error)
- func (s *HeartbeatStore) ListPings(ctx context.Context, heartbeatID string, opts heartbeat.ListPingsOpts) ([]*heartbeat.HeartbeatPing, int, error)
- func (s *HeartbeatStore) PauseHeartbeat(ctx context.Context, id string) error
- func (s *HeartbeatStore) ResumeHeartbeat(ctx context.Context, id string, nextDeadlineAt time.Time) error
- func (s *HeartbeatStore) UpdateExecution(ctx context.Context, id string, completedAt *time.Time, durationMs *int64, ...) error
- func (s *HeartbeatStore) UpdateHeartbeat(ctx context.Context, id string, input heartbeat.UpdateHeartbeatInput) error
- func (s *HeartbeatStore) UpdateHeartbeatState(ctx context.Context, id string, status heartbeat.HeartbeatStatus, ...) error
- type IncidentStoreImpl
- func (s *IncidentStoreImpl) CreateIncident(ctx context.Context, inc *status.Incident, componentIDs []string, ...) (string, error)
- func (s *IncidentStoreImpl) CreateUpdate(ctx context.Context, u *status.IncidentUpdate) (string, error)
- func (s *IncidentStoreImpl) DeleteIncident(ctx context.Context, id string) error
- func (s *IncidentStoreImpl) DeleteIncidentsOlderThan(ctx context.Context, days int) (int64, error)
- func (s *IncidentStoreImpl) GetActiveIncidentByComponent(ctx context.Context, componentID string) (*status.Incident, error)
- func (s *IncidentStoreImpl) GetIncident(ctx context.Context, id string) (*status.Incident, error)
- func (s *IncidentStoreImpl) ListActiveIncidents(ctx context.Context) ([]status.Incident, error)
- func (s *IncidentStoreImpl) ListIncidents(ctx context.Context, opts status.ListIncidentsOpts) ([]status.Incident, int, error)
- func (s *IncidentStoreImpl) ListRecentIncidents(ctx context.Context, days int) ([]status.Incident, error)
- func (s *IncidentStoreImpl) ListUpdates(ctx context.Context, incidentID string) ([]status.IncidentUpdate, error)
- func (s *IncidentStoreImpl) UpdateIncident(ctx context.Context, inc *status.Incident, componentIDs []string) error
- type KubernetesStore
- func (s *KubernetesStore) GetPod(ctx context.Context, agentID, namespace, name string) (*kubernetes.K8sPod, error)
- func (s *KubernetesStore) GetWorkload(ctx context.Context, agentID, workloadID string) (*kubernetes.K8sWorkload, error)
- func (s *KubernetesStore) ListEventsForObject(ctx context.Context, agentID, kind, namespace, name string) ([]kubernetes.K8sEvent, error)
- func (s *KubernetesStore) ListNamespaces(ctx context.Context, agentID string) ([]string, error)
- func (s *KubernetesStore) ListNodes(ctx context.Context, agentID string) ([]kubernetes.K8sNode, error)
- func (s *KubernetesStore) ListPods(ctx context.Context, agentID string, namespaces []string, ...) ([]kubernetes.K8sPod, error)
- func (s *KubernetesStore) ListWorkloads(ctx context.Context, agentID string, namespaces []string) ([]kubernetes.K8sWorkloadGroup, error)
- func (s *KubernetesStore) ReplaceEventsForAgent(ctx context.Context, agentID string, events []kubernetes.K8sEventRef) error
- func (s *KubernetesStore) ReplaceNamespacesForAgent(ctx context.Context, agentID string, namespaces []string) error
- func (s *KubernetesStore) ReplaceNodesForAgent(ctx context.Context, agentID string, nodes []kubernetes.K8sNode) error
- func (s *KubernetesStore) ReplacePodsForAgent(ctx context.Context, agentID string, pods []kubernetes.K8sPod) error
- func (s *KubernetesStore) ReplaceWorkloadsForAgent(ctx context.Context, agentID string, workloads []kubernetes.K8sWorkload) error
- type MCPOAuthStoreImpl
- func (s *MCPOAuthStoreImpl) ConsumeCode(ctx context.Context, codeHash string) (*oauth.MCPAuthCode, error)
- func (s *MCPOAuthStoreImpl) DeleteExpired(ctx context.Context) (int64, error)
- func (s *MCPOAuthStoreImpl) GetToken(ctx context.Context, tokenHash string) (*oauth.MCPOAuthToken, error)
- func (s *MCPOAuthStoreImpl) RevokeFamily(ctx context.Context, familyID string) error
- func (s *MCPOAuthStoreImpl) RevokeToken(ctx context.Context, tokenHash string) error
- func (s *MCPOAuthStoreImpl) StoreCode(ctx context.Context, code *oauth.MCPAuthCode) error
- func (s *MCPOAuthStoreImpl) StoreToken(ctx context.Context, token *oauth.MCPOAuthToken) error
- type MaintenanceStoreImpl
- func (s *MaintenanceStoreImpl) CreateMaintenance(ctx context.Context, mw *status.MaintenanceWindow, componentIDs []string) (string, error)
- func (s *MaintenanceStoreImpl) DeleteMaintenance(ctx context.Context, id string) error
- func (s *MaintenanceStoreImpl) GetMaintenance(ctx context.Context, id string) (*status.MaintenanceWindow, error)
- func (s *MaintenanceStoreImpl) GetPendingActivation(ctx context.Context, now int64) ([]status.MaintenanceWindow, error)
- func (s *MaintenanceStoreImpl) GetPendingDeactivation(ctx context.Context, now int64) ([]status.MaintenanceWindow, error)
- func (s *MaintenanceStoreImpl) IsEntitySuppressed(ctx context.Context, monitorType string, monitorID string, now time.Time) (matched bool, windowID string, endsAt time.Time, err error)
- func (s *MaintenanceStoreImpl) ListMaintenance(ctx context.Context, statusFilter string, limit int) ([]status.MaintenanceWindow, error)
- func (s *MaintenanceStoreImpl) SetActive(ctx context.Context, id string, active bool, incidentID *string) error
- func (s *MaintenanceStoreImpl) UpdateMaintenance(ctx context.Context, mw *status.MaintenanceWindow, componentIDs []string) error
- type PersonalizationStoreImpl
- func (s *PersonalizationStoreImpl) BumpVersion(ctx context.Context) error
- func (s *PersonalizationStoreImpl) CreateFAQItem(ctx context.Context, question, answerMD, answerHTML string) (status.FAQItem, error)
- func (s *PersonalizationStoreImpl) CreateFooterLink(ctx context.Context, label, url string) (status.FooterLink, error)
- func (s *PersonalizationStoreImpl) DeleteAsset(ctx context.Context, role status.AssetRole) error
- func (s *PersonalizationStoreImpl) DeleteFAQItem(ctx context.Context, id string) error
- func (s *PersonalizationStoreImpl) DeleteFooterLink(ctx context.Context, id string) error
- func (s *PersonalizationStoreImpl) GetAsset(ctx context.Context, role status.AssetRole) (*status.Asset, error)
- func (s *PersonalizationStoreImpl) GetSettings(ctx context.Context) (status.Settings, error)
- func (s *PersonalizationStoreImpl) ListFAQItems(ctx context.Context) ([]status.FAQItem, error)
- func (s *PersonalizationStoreImpl) ListFooterLinks(ctx context.Context) ([]status.FooterLink, error)
- func (s *PersonalizationStoreImpl) PutAsset(ctx context.Context, a status.Asset) error
- func (s *PersonalizationStoreImpl) ReorderFAQItems(ctx context.Context, ids []string) ([]status.FAQItem, error)
- func (s *PersonalizationStoreImpl) ReorderFooterLinks(ctx context.Context, ids []string) ([]status.FooterLink, error)
- func (s *PersonalizationStoreImpl) UpdateFAQItem(ctx context.Context, id string, question, answerMD, answerHTML string) (status.FAQItem, error)
- func (s *PersonalizationStoreImpl) UpdateFooterLink(ctx context.Context, id string, label, url string) (status.FooterLink, error)
- func (s *PersonalizationStoreImpl) UpdateSettings(ctx context.Context, in status.Settings) (status.Settings, error)
- type ResourceStore
- func (s *ResourceStore) AggregateDailyRollup(ctx context.Context, bucketStart, bucketEnd time.Time) error
- func (s *ResourceStore) AggregateHourlyRollup(ctx context.Context, bucketStart, bucketEnd time.Time) error
- func (s *ResourceStore) DeleteDailyBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *ResourceStore) DeleteHourlyBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *ResourceStore) DeleteSnapshotsBefore(ctx context.Context, before time.Time, batchSize int) (int64, error)
- func (s *ResourceStore) GetAlertConfig(ctx context.Context, containerID string) (*resource.ResourceAlertConfig, error)
- func (s *ResourceStore) GetLatestSnapshot(ctx context.Context, containerID string) (*resource.ResourceSnapshot, error)
- func (s *ResourceStore) GetTopConsumersByPeriod(ctx context.Context, metric string, period string, limit int, agentID *string) ([]resource.TopConsumerRow, error)
- func (s *ResourceStore) InsertDailyRollup(ctx context.Context, r *resource.RollupRow) error
- func (s *ResourceStore) InsertHourlyRollup(ctx context.Context, r *resource.RollupRow) error
- func (s *ResourceStore) InsertSnapshot(ctx context.Context, snap *resource.ResourceSnapshot) (string, error)
- func (s *ResourceStore) ListSnapshots(ctx context.Context, containerID string, from, to time.Time) ([]*resource.ResourceSnapshot, error)
- func (s *ResourceStore) ListSnapshotsAggregated(ctx context.Context, containerID string, from, to time.Time, ...) ([]*resource.ResourceSnapshot, error)
- func (s *ResourceStore) UpsertAlertConfig(ctx context.Context, cfg *resource.ResourceAlertConfig) error
- type RetentionOpts
- type SilenceStoreImpl
- func (s *SilenceStoreImpl) CancelSilenceRule(ctx context.Context, id string) error
- func (s *SilenceStoreImpl) GetActiveSilenceRules(ctx context.Context) ([]*alert.SilenceRule, error)
- func (s *SilenceStoreImpl) InsertSilenceRule(ctx context.Context, rule *alert.SilenceRule) (string, error)
- func (s *SilenceStoreImpl) ListSilenceRules(ctx context.Context, activeOnly bool) ([]*alert.SilenceRule, error)
- type StatusComponentStoreImpl
- func (s *StatusComponentStoreImpl) CountConfigured(ctx context.Context) (int, error)
- func (s *StatusComponentStoreImpl) CreateComponent(ctx context.Context, c *status.Component) (string, error)
- func (s *StatusComponentStoreImpl) DeleteComponent(ctx context.Context, id string) error
- func (s *StatusComponentStoreImpl) GetComponent(ctx context.Context, id string) (*status.Component, error)
- func (s *StatusComponentStoreImpl) ListComponents(ctx context.Context) ([]status.Component, error)
- func (s *StatusComponentStoreImpl) ListComponentsByMonitor(ctx context.Context, monitorType string, monitorID string) ([]status.Component, error)
- func (s *StatusComponentStoreImpl) ListVisibleComponents(ctx context.Context) ([]status.Component, error)
- func (s *StatusComponentStoreImpl) RemoveDanglingMonitorRefs(ctx context.Context, monitorType string, monitorID string) error
- func (s *StatusComponentStoreImpl) UpdateComponent(ctx context.Context, c *status.Component) error
- type SubscriberStoreImpl
- func (s *SubscriberStoreImpl) CleanExpiredUnconfirmed(ctx context.Context) (int64, error)
- func (s *SubscriberStoreImpl) ConfirmSubscriber(ctx context.Context, id string) error
- func (s *SubscriberStoreImpl) CreateSubscriber(ctx context.Context, sub *status.StatusSubscriber) (string, error)
- func (s *SubscriberStoreImpl) DeleteSubscriber(ctx context.Context, id string) error
- func (s *SubscriberStoreImpl) GetSubscriberByToken(ctx context.Context, confirmToken string) (*status.StatusSubscriber, error)
- func (s *SubscriberStoreImpl) GetSubscriberByUnsubToken(ctx context.Context, unsubToken string) (*status.StatusSubscriber, error)
- func (s *SubscriberStoreImpl) GetSubscriberStats(ctx context.Context) (*status.SubscriberStats, error)
- func (s *SubscriberStoreImpl) ListConfirmedSubscribers(ctx context.Context) ([]status.StatusSubscriber, error)
- func (s *SubscriberStoreImpl) ListSubscribers(ctx context.Context) ([]status.StatusSubscriber, error)
- type SwarmNodeStore
- func (s *SwarmNodeStore) GetNodeByNodeID(ctx context.Context, nodeID string) (*swarm.SwarmNode, error)
- func (s *SwarmNodeStore) ListNodes(ctx context.Context, agentID string) ([]*swarm.SwarmNode, error)
- func (s *SwarmNodeStore) ReplaceNodesForAgent(ctx context.Context, agentID string, nodes []*swarm.SwarmNode) error
- func (s *SwarmNodeStore) UpdateNodeStatus(ctx context.Context, nodeID, status, availability string) error
- func (s *SwarmNodeStore) UpdateNodeTaskCount(ctx context.Context, nodeID string, count int) error
- func (s *SwarmNodeStore) UpsertNode(ctx context.Context, node *swarm.SwarmNode) error
- type SwarmTopologyStore
- func (s *SwarmTopologyStore) ListServices(ctx context.Context, agentID string) ([]*swarm.SwarmService, error)
- func (s *SwarmTopologyStore) ListTasks(ctx context.Context, agentID, serviceID string) ([]*swarm.SwarmTask, error)
- func (s *SwarmTopologyStore) ReplaceServicesForAgent(ctx context.Context, agentID string, services []swarm.SwarmService) error
- func (s *SwarmTopologyStore) ReplaceTasksForAgent(ctx context.Context, agentID string, tasks []swarm.SwarmTask) error
- type TriggerStoreImpl
- func (s *TriggerStoreImpl) DeleteTrigger(ctx context.Context, id string) error
- func (s *TriggerStoreImpl) GetTrigger(ctx context.Context, id string) (*alert.AlertTrigger, error)
- func (s *TriggerStoreImpl) InsertTrigger(ctx context.Context, t *alert.AlertTrigger) (string, error)
- func (s *TriggerStoreImpl) ListChannelsForTrigger(ctx context.Context, triggerID string) ([]string, error)
- func (s *TriggerStoreImpl) ListEnabledTriggers(ctx context.Context) ([]*alert.AlertTrigger, error)
- func (s *TriggerStoreImpl) ListTriggers(ctx context.Context) ([]*alert.AlertTrigger, error)
- func (s *TriggerStoreImpl) ListTriggersForChannel(ctx context.Context, channelID string) ([]*alert.AlertTrigger, error)
- func (s *TriggerStoreImpl) SetChannels(ctx context.Context, triggerID string, channelIDs []string) error
- func (s *TriggerStoreImpl) UpdateTrigger(ctx context.Context, t *alert.AlertTrigger) error
- type UpdateStore
- func (s *UpdateStore) CleanupExpired(ctx context.Context, olderThan time.Time) (int64, error)
- func (s *UpdateStore) DeleteContainerCVEs(ctx context.Context, containerID string) error
- func (s *UpdateStore) DeleteExclusion(ctx context.Context, id string) error
- func (s *UpdateStore) DeleteImageUpdatesByContainer(ctx context.Context, containerID string) error
- func (s *UpdateStore) DeleteStaleImageUpdates(ctx context.Context, scanID string, scannedContainerNames []string) (int64, error)
- func (s *UpdateStore) DeleteVersionPin(ctx context.Context, containerID string) error
- func (s *UpdateStore) GetCVECacheEntries(ctx context.Context, ecosystem, packageName, packageVersion string) ([]*update.CVECacheEntry, error)
- func (s *UpdateStore) GetCVESummaryCounts(ctx context.Context) (map[string]int, error)
- func (s *UpdateStore) GetDigestBaseline(ctx context.Context, containerID string) (*update.DigestBaseline, error)
- func (s *UpdateStore) GetImageUpdate(ctx context.Context, id string) (*update.ImageUpdate, error)
- func (s *UpdateStore) GetImageUpdateByContainer(ctx context.Context, containerID string) (*update.ImageUpdate, error)
- func (s *UpdateStore) GetLatestScanRecord(ctx context.Context) (*update.ScanRecord, error)
- func (s *UpdateStore) GetScanRecord(ctx context.Context, id string) (*update.ScanRecord, error)
- func (s *UpdateStore) GetUpdateSummary(ctx context.Context) (*update.UpdateSummary, error)
- func (s *UpdateStore) GetVersionPin(ctx context.Context, containerID string) (*update.VersionPin, error)
- func (s *UpdateStore) InsertCVECacheEntry(ctx context.Context, e *update.CVECacheEntry) (string, error)
- func (s *UpdateStore) InsertExclusion(ctx context.Context, e *update.UpdateExclusion) (string, error)
- func (s *UpdateStore) InsertImageUpdate(ctx context.Context, u *update.ImageUpdate) (string, error)
- func (s *UpdateStore) InsertRiskScoreRecord(ctx context.Context, r *update.RiskScoreRecord) (string, error)
- func (s *UpdateStore) InsertScanRecord(ctx context.Context, r *update.ScanRecord) (string, error)
- func (s *UpdateStore) InsertVersionPin(ctx context.Context, p *update.VersionPin) (string, error)
- func (s *UpdateStore) IsCVECacheFresh(ctx context.Context, ecosystem, packageName, packageVersion string) (bool, error)
- func (s *UpdateStore) ListAllActiveCVEs(ctx context.Context, opts update.ListCVEsOpts) ([]*update.ContainerCVE, error)
- func (s *UpdateStore) ListContainerCVEs(ctx context.Context, containerID string) ([]*update.ContainerCVE, error)
- func (s *UpdateStore) ListExclusions(ctx context.Context) ([]*update.UpdateExclusion, error)
- func (s *UpdateStore) ListImageUpdates(ctx context.Context, opts update.ListImageUpdatesOpts) ([]*update.ImageUpdate, error)
- func (s *UpdateStore) ListRiskScoreHistory(ctx context.Context, containerID string, from, to time.Time) ([]*update.RiskScoreRecord, error)
- func (s *UpdateStore) ListStaleImageUpdates(ctx context.Context, scanID string, scannedContainerNames []string) ([]update.StaleImageUpdate, error)
- func (s *UpdateStore) ResolveContainerCVE(ctx context.Context, containerID, cveID string) error
- func (s *UpdateStore) UpdateImageUpdate(ctx context.Context, u *update.ImageUpdate) error
- func (s *UpdateStore) UpdateScanRecord(ctx context.Context, r *update.ScanRecord) error
- func (s *UpdateStore) UpsertContainerCVE(ctx context.Context, c *update.ContainerCVE) error
- func (s *UpdateStore) UpsertDigestBaseline(ctx context.Context, b *update.DigestBaseline) error
- type UptimeDailyStore
- func (s *UptimeDailyStore) GetContainerDailyUptime(ctx context.Context, containerID string, days int) ([]DailyUptime, error)
- func (s *UptimeDailyStore) GetEndpointDailyUptime(ctx context.Context, endpointID string, days int) ([]DailyUptime, error)
- func (s *UptimeDailyStore) GetHeartbeatDailyUptime(ctx context.Context, heartbeatID string, days int) ([]DailyUptime, error)
- type WebhookStoreImpl
- func (s *WebhookStoreImpl) CountConfigured(ctx context.Context) (int, error)
- func (s *WebhookStoreImpl) Create(ctx context.Context, sub *webhook.WebhookSubscription) error
- func (s *WebhookStoreImpl) Delete(ctx context.Context, id string) error
- func (s *WebhookStoreImpl) GetByID(ctx context.Context, id string) (*webhook.WebhookSubscription, error)
- func (s *WebhookStoreImpl) List(ctx context.Context) ([]*webhook.WebhookSubscription, error)
- func (s *WebhookStoreImpl) ListActive(ctx context.Context) ([]*webhook.WebhookSubscription, error)
- func (s *WebhookStoreImpl) UpdateDeliveryStatus(ctx context.Context, id string, status string, failureCount int) error
- type WriteOp
- type WriteResult
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
Migrate runs all pending database migrations using golang-migrate v4. On the first run after upgrading from the custom migration system, it bootstraps the schema_migrations table from the old schema_version table.
func NullableString ¶
func NullableString(s string) interface{}
NullableString returns nil if s is empty, otherwise returns s. Used for nullable TEXT columns in SQLite.
func StartRetentionCleanupWithOpts ¶
func StartRetentionCleanupWithOpts(ctx context.Context, store *ContainerStore, db *DB, logger *slog.Logger, opts RetentionOpts)
StartRetentionCleanupWithOpts starts retention cleanup with all store types.
Types ¶
type AcknowledgmentStoreImpl ¶ added in v1.1.0
type AcknowledgmentStoreImpl struct {
// contains filtered or unexported fields
}
AcknowledgmentStoreImpl implements security.AcknowledgmentStore using SQLite.
func NewAcknowledgmentStore ¶ added in v1.1.0
func NewAcknowledgmentStore(d *DB) *AcknowledgmentStoreImpl
NewAcknowledgmentStore creates a new SQLite-backed acknowledgment store.
func (*AcknowledgmentStoreImpl) DeleteAcknowledgment ¶ added in v1.1.0
func (s *AcknowledgmentStoreImpl) DeleteAcknowledgment(ctx context.Context, id string) error
func (*AcknowledgmentStoreImpl) GetAcknowledgment ¶ added in v1.1.0
func (s *AcknowledgmentStoreImpl) GetAcknowledgment(ctx context.Context, id string) (*security.RiskAcknowledgment, error)
func (*AcknowledgmentStoreImpl) InsertAcknowledgment ¶ added in v1.1.0
func (s *AcknowledgmentStoreImpl) InsertAcknowledgment(ctx context.Context, ack *security.RiskAcknowledgment) (string, error)
func (*AcknowledgmentStoreImpl) IsAcknowledged ¶ added in v1.1.0
func (*AcknowledgmentStoreImpl) ListAcknowledgments ¶ added in v1.1.0
func (s *AcknowledgmentStoreImpl) ListAcknowledgments(ctx context.Context, containerExternalID string) ([]*security.RiskAcknowledgment, error)
type AgentStore ¶ added in v1.3.0
type AgentStore struct {
// contains filtered or unexported fields
}
AgentStore handles persistence for agents and enrollment tokens. The agents table primary key is `id` (the agent-generated UUID); timestamps are stored as epoch-second BIGINTs.
func NewAgentStore ¶ added in v1.3.0
func NewAgentStore(d *DB) *AgentStore
NewAgentStore creates a new AgentStore.
func (*AgentStore) CountByRuntime ¶ added in v1.3.0
func (s *AgentStore) CountByRuntime(ctx context.Context) (docker, swarm, kubernetes int, err error)
CountByRuntime returns active agent counts grouped by detected_runtime.
func (*AgentStore) CountByStatus ¶ added in v1.3.0
func (s *AgentStore) CountByStatus(ctx context.Context) (active, revoked int, err error)
CountByStatus returns agent counts grouped by status.
func (*AgentStore) Delete ¶ added in v1.3.0
func (s *AgentStore) Delete(ctx context.Context, agentID string) error
Delete hard-deletes an agent and all its events via FK ON DELETE CASCADE.
func (*AgentStore) DeleteToken ¶ added in v1.3.0
func (s *AgentStore) DeleteToken(ctx context.Context, tokenID string) error
DeleteToken removes an unconsumed token.
func (*AgentStore) EnrollAtomic ¶ added in v1.3.0
func (s *AgentStore) EnrollAtomic(ctx context.Context, limit int, tokenCleartext string, a *agent.Agent) error
EnrollAtomic enforces the per-edition host cap, consumes the one-time token, and inserts the agent as a single serialized transaction. Because the count, the token consume, and the insert run in one writer-goroutine transaction, no two concurrent enrollments can both pass the cap check and over-fill it. A limit < 0 means unlimited; the local sentinel is never counted. Returns ErrHostLimitReached, ErrTokenNotFound, ErrTokenAlreadyConsumed, or ErrTokenExpired.
func (*AgentStore) GcExpiredTokens ¶ added in v1.3.0
func (s *AgentStore) GcExpiredTokens(ctx context.Context) error
GcExpiredTokens removes unconsumed tokens that expired more than 7 days ago.
func (*AgentStore) GetByToken ¶ added in v1.3.0
func (s *AgentStore) GetByToken(ctx context.Context, tokenCleartext string) (*agent.EnrollmentToken, error)
GetByToken retrieves a token by its cleartext value.
func (*AgentStore) GetTokenByID ¶ added in v1.3.0
func (s *AgentStore) GetTokenByID(ctx context.Context, tokenID string) (*agent.EnrollmentToken, error)
GetTokenByID retrieves a token by its opaque id.
func (*AgentStore) InsertToken ¶ added in v1.3.0
func (s *AgentStore) InsertToken(ctx context.Context, t *agent.EnrollmentToken) error
InsertToken persists a new enrollment token.
func (*AgentStore) List ¶ added in v1.3.0
List retrieves agents with an optional status filter ("" or "all" = all). The local sentinel agent is an internal FK anchor, not an enrolled agent, so it is never surfaced in listings.
func (*AgentStore) ListTokens ¶ added in v1.3.0
func (s *AgentStore) ListTokens(ctx context.Context, includeExpired, includeConsumed bool) ([]*agent.EnrollmentToken, error)
ListTokens returns all tokens with optional filters.
func (*AgentStore) Revoke ¶ added in v1.3.0
func (s *AgentStore) Revoke(ctx context.Context, agentID, revokedBy string) error
Revoke marks an agent as revoked.
func (*AgentStore) StaleAgents ¶ added in v1.3.0
StaleAgents returns IDs of active agents whose last_seen_at is older than threshold.
func (*AgentStore) UpdateLabel ¶ added in v1.3.0
func (s *AgentStore) UpdateLabel(ctx context.Context, agentID, label string) error
UpdateLabel updates the display label for an agent.
func (*AgentStore) UpdateLastSeen ¶ added in v1.3.0
UpdateLastSeen updates the last_seen_at timestamp.
type AlertStoreImpl ¶
type AlertStoreImpl struct {
// contains filtered or unexported fields
}
AlertStoreImpl implements alert.AlertStore using SQLite.
func NewAlertStore ¶
func NewAlertStore(d *DB) *AlertStoreImpl
NewAlertStore creates a new SQLite-backed alert store.
func (*AlertStoreImpl) AcknowledgeAlert ¶ added in v1.0.1
func (*AlertStoreImpl) DeleteAlertsOlderThan ¶
func (*AlertStoreImpl) GetActiveAlert ¶
func (*AlertStoreImpl) InsertAlert ¶
func (*AlertStoreImpl) ListActiveAlerts ¶
func (*AlertStoreImpl) ListAlerts ¶
func (s *AlertStoreImpl) ListAlerts(ctx context.Context, opts alert.ListAlertsOpts) ([]*alert.Alert, error)
func (*AlertStoreImpl) ListUnacknowledgedActiveAlerts ¶ added in v1.0.1
func (*AlertStoreImpl) SetEscalatedAt ¶ added in v1.0.1
func (*AlertStoreImpl) UpdateAlertOnEscalation ¶ added in v1.3.0
func (s *AlertStoreImpl) UpdateAlertOnEscalation(ctx context.Context, id, severity, message, entityName, details string) error
type CertificateStore ¶
type CertificateStore struct {
// contains filtered or unexported fields
}
CertificateStore implements certificate.CertificateStore using SQLite.
func NewCertificateStore ¶
func NewCertificateStore(d *DB) *CertificateStore
NewCertificateStore creates a new SQLite-backed certificate store.
func (*CertificateStore) CountConfigured ¶ added in v1.2.7
func (s *CertificateStore) CountConfigured(ctx context.Context) (int, error)
CountConfigured returns the number of certificate monitors. Operator-created and auto-detected entries are both counted; the table uses hard-delete only, so no soft-delete filter is needed. Used by the telemetry subsystem; see specs/015-shm-telemetry.
func (*CertificateStore) CountStandaloneMonitors ¶ added in v1.2.2
func (s *CertificateStore) CountStandaloneMonitors(ctx context.Context) (int, error)
func (*CertificateStore) CreateMonitor ¶
func (s *CertificateStore) CreateMonitor(ctx context.Context, m *certificate.CertMonitor) (string, error)
CreateMonitor upserts a cert monitor. Its id is derived deterministically from (agent_id, hostname, port, server_name) so the agent and server mint the same id; a repeat report for the same host updates the existing row's mutable settings.
func (*CertificateStore) DeleteCheckResultsBefore ¶
func (*CertificateStore) DeleteMonitor ¶ added in v1.2.5
func (s *CertificateStore) DeleteMonitor(ctx context.Context, id string) error
DeleteMonitor hard-deletes a certificate monitor. Associated check results and chain entries are removed via ON DELETE CASCADE.
func (*CertificateStore) GetChainEntries ¶
func (s *CertificateStore) GetChainEntries(ctx context.Context, checkResultID string) ([]*certificate.CertChainEntry, error)
func (*CertificateStore) GetLatestCheckResult ¶
func (s *CertificateStore) GetLatestCheckResult(ctx context.Context, monitorID string) (*certificate.CertCheckResult, error)
func (*CertificateStore) GetMonitorByEndpointID ¶
func (s *CertificateStore) GetMonitorByEndpointID(ctx context.Context, endpointID string) (*certificate.CertMonitor, error)
func (*CertificateStore) GetMonitorByHostPort ¶
func (s *CertificateStore) GetMonitorByHostPort(ctx context.Context, hostname string, port int, serverName string) (*certificate.CertMonitor, error)
func (*CertificateStore) GetMonitorByHostPortAgent ¶ added in v1.3.0
func (s *CertificateStore) GetMonitorByHostPortAgent(ctx context.Context, agentID *string, hostname string, port int, serverName string) (*certificate.CertMonitor, error)
GetMonitorByHostPortAgent resolves a monitor scoped to a given agent (or the local server when agentID is nil/empty). Matches the agent-aware identity (agent_id, hostname, port, server_name) so a remote agent's localhost:443 does not collide with the server's own or another agent's.
func (*CertificateStore) GetMonitorByID ¶
func (s *CertificateStore) GetMonitorByID(ctx context.Context, id string) (*certificate.CertMonitor, error)
func (*CertificateStore) InsertChainEntries ¶
func (s *CertificateStore) InsertChainEntries(ctx context.Context, entries []*certificate.CertChainEntry) error
func (*CertificateStore) InsertCheckResult ¶
func (s *CertificateStore) InsertCheckResult(ctx context.Context, result *certificate.CertCheckResult) (string, error)
func (*CertificateStore) ListCheckResults ¶
func (s *CertificateStore) ListCheckResults(ctx context.Context, monitorID string, opts certificate.ListChecksOpts) ([]*certificate.CertCheckResult, int, error)
func (*CertificateStore) ListDueScheduledMonitors ¶
func (s *CertificateStore) ListDueScheduledMonitors(ctx context.Context, now time.Time) ([]*certificate.CertMonitor, error)
func (*CertificateStore) ListMonitors ¶
func (s *CertificateStore) ListMonitors(ctx context.Context, opts certificate.ListCertificatesOpts) ([]*certificate.CertMonitor, error)
func (*CertificateStore) ListMonitorsByExternalID ¶
func (s *CertificateStore) ListMonitorsByExternalID(ctx context.Context, externalID string) ([]*certificate.CertMonitor, error)
func (*CertificateStore) UpdateMonitor ¶
func (s *CertificateStore) UpdateMonitor(ctx context.Context, m *certificate.CertMonitor) error
type ChannelStoreImpl ¶
type ChannelStoreImpl struct {
// contains filtered or unexported fields
}
ChannelStoreImpl implements alert.ChannelStore using SQLite.
func NewChannelStore ¶
func NewChannelStore(d *DB) *ChannelStoreImpl
NewChannelStore creates a new SQLite-backed channel store.
func (*ChannelStoreImpl) DeleteChannel ¶
func (s *ChannelStoreImpl) DeleteChannel(ctx context.Context, id string) error
func (*ChannelStoreImpl) GetChannel ¶
func (s *ChannelStoreImpl) GetChannel(ctx context.Context, id string) (*alert.NotificationChannel, error)
func (*ChannelStoreImpl) GetChannelHealth ¶
func (*ChannelStoreImpl) InsertChannel ¶
func (s *ChannelStoreImpl) InsertChannel(ctx context.Context, ch *alert.NotificationChannel) (string, error)
func (*ChannelStoreImpl) InsertDelivery ¶
func (s *ChannelStoreImpl) InsertDelivery(ctx context.Context, d *alert.NotificationDelivery) (string, error)
func (*ChannelStoreImpl) ListChannels ¶
func (s *ChannelStoreImpl) ListChannels(ctx context.Context) ([]*alert.NotificationChannel, error)
func (*ChannelStoreImpl) ListDeliveriesByAlert ¶
func (s *ChannelStoreImpl) ListDeliveriesByAlert(ctx context.Context, alertID string) ([]*alert.NotificationDelivery, error)
func (*ChannelStoreImpl) UpdateChannel ¶
func (s *ChannelStoreImpl) UpdateChannel(ctx context.Context, ch *alert.NotificationChannel) error
func (*ChannelStoreImpl) UpdateDelivery ¶
func (s *ChannelStoreImpl) UpdateDelivery(ctx context.Context, d *alert.NotificationDelivery) error
type ContainerStore ¶
type ContainerStore struct {
// contains filtered or unexported fields
}
ContainerStore implements container.ContainerStore using SQLite.
func NewContainerStore ¶
func NewContainerStore(d *DB) *ContainerStore
NewContainerStore creates a new SQLite-backed container store.
func (*ContainerStore) ArchiveContainer ¶
func (*ContainerStore) CountConfigured ¶ added in v1.2.7
func (s *ContainerStore) CountConfigured(ctx context.Context) (int, error)
CountConfigured returns the number of non-archived auto-discovered containers. Used by the telemetry subsystem; see specs/015-shm-telemetry.
func (*ContainerStore) CountRestartsSince ¶
func (*ContainerStore) DeleteArchivedContainersBefore ¶
func (*ContainerStore) DeleteContainerByID ¶
func (s *ContainerStore) DeleteContainerByID(ctx context.Context, id string) error
func (*ContainerStore) DeleteTransitionsBefore ¶
func (*ContainerStore) GetContainerByExternalID ¶
func (*ContainerStore) GetContainerByID ¶
func (*ContainerStore) GetTransitionsInWindow ¶
func (s *ContainerStore) GetTransitionsInWindow(ctx context.Context, containerID string, from, to time.Time) ([]*container.StateTransition, error)
func (*ContainerStore) InsertContainer ¶
func (s *ContainerStore) InsertContainer(ctx context.Context, c *container.Container) (string, error)
InsertContainer upserts a container. Its id is derived deterministically from (agent_id, external_id) so the agent and server mint the same id; a repeat report updates the existing row.
func (*ContainerStore) InsertTransition ¶
func (s *ContainerStore) InsertTransition(ctx context.Context, t *container.StateTransition) (string, error)
InsertTransition records a state transition.
func (*ContainerStore) ListContainers ¶
func (s *ContainerStore) ListContainers(ctx context.Context, opts container.ListContainersOpts) ([]*container.Container, error)
func (*ContainerStore) ListTransitionsByContainer ¶
func (s *ContainerStore) ListTransitionsByContainer(ctx context.Context, containerID string, opts container.ListTransitionsOpts) ([]*container.StateTransition, int, error)
func (*ContainerStore) UpdateContainer ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite database connection with maintenant configuration.
func Open ¶
Open creates and configures a SQLite database connection with WAL mode.
This is the only SQLite-specific seam: the schema (uuid_schema.sql) and all queries use the portable common subset (TEXT/BIGINT/INTEGER/REAL/BLOB ids and timestamps, ON CONFLICT upserts, `?` placeholders, no AUTOINCREMENT/PRAGMA). A Postgres backend is a drop-in: its own Open (pgx DSN), a `?`→`$n` placeholder rewrite, and a Postgres migrations dir — no schema or query changes.
func (*DB) StartWriter ¶
StartWriter starts the single-writer goroutine.
type DailyUptime ¶
type DailyUptime struct {
Date string `json:"date"`
UptimePercent *float64 `json:"uptime_percent"`
IncidentCount int `json:"incident_count"`
}
DailyUptime represents a single day's uptime aggregation.
type EndpointStore ¶
type EndpointStore struct {
// contains filtered or unexported fields
}
EndpointStore implements endpoint.EndpointStore using SQLite.
func NewEndpointStore ¶
func NewEndpointStore(d *DB) *EndpointStore
NewEndpointStore creates a new SQLite-backed endpoint store.
func (*EndpointStore) CountActiveEndpoints ¶ added in v1.2.2
func (s *EndpointStore) CountActiveEndpoints(ctx context.Context) (int, error)
func (*EndpointStore) CountConfigured ¶ added in v1.2.7
func (s *EndpointStore) CountConfigured(ctx context.Context) (int, error)
CountConfigured returns the number of operator-configured active endpoints. Soft-deleted (active=0) entries pending retention cleanup are excluded. Used by the telemetry subsystem; see specs/015-shm-telemetry.
func (*EndpointStore) DeactivateEndpoint ¶
func (s *EndpointStore) DeactivateEndpoint(ctx context.Context, id string) error
func (*EndpointStore) DeleteCheckResultsBefore ¶
func (*EndpointStore) DeleteInactiveEndpointsBefore ¶
func (*EndpointStore) DeleteStandaloneEndpoint ¶ added in v1.1.2
func (s *EndpointStore) DeleteStandaloneEndpoint(ctx context.Context, id string) error
DeleteStandaloneEndpoint permanently removes a standalone endpoint and its check results.
func (*EndpointStore) GetActiveAgentEndpointByTarget ¶ added in v1.3.0
func (s *EndpointStore) GetActiveAgentEndpointByTarget(ctx context.Context, agentID, target string) (*endpoint.Endpoint, error)
GetActiveAgentEndpointByTarget resolves an active endpoint pushed by a remote agent, keyed by (agent_id, target). Used to attach a pushed probe result to the endpoint the server provisioned from that agent's container labels.
func (*EndpointStore) GetCheckResultsInWindow ¶
func (*EndpointStore) GetEndpointByID ¶
func (*EndpointStore) GetEndpointByIdentity ¶
func (*EndpointStore) GetSparklineData ¶
func (s *EndpointStore) GetSparklineData(ctx context.Context, limit int) (map[string][]float64, error)
GetSparklineData returns the last N response_time_ms values per active endpoint.
func (*EndpointStore) InsertCheckResult ¶
func (s *EndpointStore) InsertCheckResult(ctx context.Context, result *endpoint.CheckResult) (string, error)
func (*EndpointStore) InsertStandaloneEndpoint ¶ added in v1.1.2
func (s *EndpointStore) InsertStandaloneEndpoint(ctx context.Context, e *endpoint.Endpoint) (string, error)
InsertStandaloneEndpoint creates a manually-defined endpoint (not from container labels). Its identity is (agent_id, empty container_name, label_key=external_id) where the external_id is a freshly minted unique key, so the derived id is stable.
func (*EndpointStore) ListCheckResults ¶
func (s *EndpointStore) ListCheckResults(ctx context.Context, endpointID string, opts endpoint.ListChecksOpts) ([]*endpoint.CheckResult, int, error)
func (*EndpointStore) ListEndpoints ¶
func (s *EndpointStore) ListEndpoints(ctx context.Context, opts endpoint.ListEndpointsOpts) ([]*endpoint.Endpoint, error)
func (*EndpointStore) ListEndpointsByExternalID ¶
func (*EndpointStore) UpdateCheckResult ¶
func (s *EndpointStore) UpdateCheckResult(ctx context.Context, id string, status endpoint.EndpointStatus, alertState endpoint.AlertState, consecutiveFailures, consecutiveSuccesses int, responseTimeMs int64, httpStatus *int, lastError string) error
func (*EndpointStore) UpdateStandaloneEndpoint ¶ added in v1.1.2
func (s *EndpointStore) UpdateStandaloneEndpoint(ctx context.Context, id string, name, target string, endpointType endpoint.EndpointType, configJSON string) error
UpdateStandaloneEndpoint updates a standalone endpoint's mutable fields.
func (*EndpointStore) UpsertEndpoint ¶
UpsertEndpoint upserts a label-discovered endpoint. Its id is derived deterministically from (agent_id, container_name, label_key) so the agent and server mint the same id; a repeat report updates the existing row.
type EscalationStore ¶ added in v1.2.12
type EscalationStore struct {
// contains filtered or unexported fields
}
EscalationStore implements escalation.Store using SQLite.
func NewEscalationStore ¶ added in v1.2.12
func NewEscalationStore(d *DB) *EscalationStore
NewEscalationStore creates a new SQLite-backed escalation store.
func (*EscalationStore) BulkDeactivateAllPolicies ¶ added in v1.2.12
func (s *EscalationStore) BulkDeactivateAllPolicies(ctx context.Context) error
func (*EscalationStore) BulkRestorePoliciesFromDowngrade ¶ added in v1.2.12
func (s *EscalationStore) BulkRestorePoliciesFromDowngrade(ctx context.Context) error
func (*EscalationStore) BulkStopActiveRuns ¶ added in v1.2.12
func (*EscalationStore) CountActivePolicies ¶ added in v1.2.12
func (s *EscalationStore) CountActivePolicies(ctx context.Context) (int, error)
func (*EscalationStore) DeletePolicy ¶ added in v1.2.12
func (s *EscalationStore) DeletePolicy(ctx context.Context, id string) error
func (*EscalationStore) InsertDelivery ¶ added in v1.2.12
func (s *EscalationStore) InsertDelivery(ctx context.Context, d *escalation.Delivery) (string, error)
InsertDelivery reserves a delivery slot. Returns escalation.ErrDeliveryDuplicate when (run_id, level_index, channel_id) already exists — the caller treats this as "already attempted" (R4 reserve-then-deliver idempotence).
func (*EscalationStore) InsertPolicy ¶ added in v1.2.12
func (s *EscalationStore) InsertPolicy(ctx context.Context, p *escalation.Policy) (string, error)
func (*EscalationStore) InsertRun ¶ added in v1.2.12
func (s *EscalationStore) InsertRun(ctx context.Context, r *escalation.Run) (string, error)
InsertRun persists a new escalation run.
func (*EscalationStore) PauseRunForMaintenance ¶ added in v1.2.12
func (s *EscalationStore) PauseRunForMaintenance(ctx context.Context, runID string, recheckAt time.Time) error
PauseRunForMaintenance moves an active run to paused_by_maintenance and schedules a recheck. Returning to active happens via ResumeRunFromMaintenance.
func (*EscalationStore) PurgeRunsAndDeliveriesOlderThan ¶ added in v1.2.12
func (s *EscalationStore) PurgeRunsAndDeliveriesOlderThan(ctx context.Context, before time.Time) error
PurgeRunsAndDeliveriesOlderThan deletes terminated runs (ended_at < before) in batches of 1000. Cascade delete handles escalation_deliveries automatically.
func (*EscalationStore) ResumeRunFromMaintenance ¶ added in v1.2.12
func (s *EscalationStore) ResumeRunFromMaintenance(ctx context.Context, runID string, nextActionAt time.Time) error
ResumeRunFromMaintenance flips a paused run back to active with an updated due time.
func (*EscalationStore) SelectActiveRunsByAlert ¶ added in v1.2.12
func (s *EscalationStore) SelectActiveRunsByAlert(ctx context.Context, alertID string) ([]*escalation.Run, error)
SelectActiveRunsByAlert returns runs in non-terminal state for a given alert. Used by ack/resolve hooks and OnAlertCreated dedup.
func (*EscalationStore) SelectDueRuns ¶ added in v1.2.12
func (s *EscalationStore) SelectDueRuns(ctx context.Context, now time.Time) ([]*escalation.Run, error)
SelectDueRuns returns runs in status 'active' or 'paused_by_maintenance' whose next_action_at is at or before now. The partial index covers the active case; paused runs fall back to a small-table scan (acceptable: <200 paused runs per spec hypothesis v1).
func (*EscalationStore) SelectOrphanPendingDeliveries ¶ added in v1.2.12
func (s *EscalationStore) SelectOrphanPendingDeliveries(ctx context.Context, before time.Time) ([]*escalation.Delivery, error)
SelectOrphanPendingDeliveries returns deliveries stuck in 'pending' for longer than the runner's orphan timeout. The runner decides whether to retry or abandon.
func (*EscalationStore) SelectPolicies ¶ added in v1.2.12
func (s *EscalationStore) SelectPolicies(ctx context.Context, activeOnly bool) ([]*escalation.Policy, error)
func (*EscalationStore) SelectPolicy ¶ added in v1.2.12
func (s *EscalationStore) SelectPolicy(ctx context.Context, id string) (*escalation.Policy, error)
func (*EscalationStore) SelectRun ¶ added in v1.2.12
func (s *EscalationStore) SelectRun(ctx context.Context, id string) (*escalation.Run, error)
func (*EscalationStore) SelectRunDeliveries ¶ added in v1.2.12
func (s *EscalationStore) SelectRunDeliveries(ctx context.Context, runID string) ([]*escalation.Delivery, error)
func (*EscalationStore) SelectRunsByAlert ¶ added in v1.2.12
func (s *EscalationStore) SelectRunsByAlert(ctx context.Context, alertID string) ([]*escalation.Run, error)
func (*EscalationStore) SelectRunsByPolicy ¶ added in v1.2.12
func (s *EscalationStore) SelectRunsByPolicy(ctx context.Context, policyID string, limit int, cursor string) ([]*escalation.Run, error)
func (*EscalationStore) TerminateRun ¶ added in v1.2.12
func (s *EscalationStore) TerminateRun(ctx context.Context, runID string, status string, endedAt time.Time) error
TerminateRun moves a run to a terminal status (stopped_by_*, exhausted) and stamps ended_at.
func (*EscalationStore) UpdateDelivery ¶ added in v1.2.12
func (s *EscalationStore) UpdateDelivery(ctx context.Context, d *escalation.Delivery) error
UpdateDelivery persists status/error/sent_at after a send attempt completes.
func (*EscalationStore) UpdatePolicy ¶ added in v1.2.12
func (s *EscalationStore) UpdatePolicy(ctx context.Context, p *escalation.Policy) error
func (*EscalationStore) UpdateRunProgress ¶ added in v1.2.12
func (s *EscalationStore) UpdateRunProgress(ctx context.Context, runID string, lastExecutedLevelIndex int, nextActionAt *time.Time, status string) error
UpdateRunProgress advances a run's level cursor and reschedules its next action. Used by the runner after executing a level (R4 reserve-then-deliver).
type HeartbeatStore ¶
type HeartbeatStore struct {
// contains filtered or unexported fields
}
HeartbeatStore implements heartbeat.HeartbeatStore using SQLite.
func NewHeartbeatStore ¶
func NewHeartbeatStore(d *DB) *HeartbeatStore
NewHeartbeatStore creates a new SQLite-backed heartbeat store.
func (*HeartbeatStore) CountActiveHeartbeats ¶
func (s *HeartbeatStore) CountActiveHeartbeats(ctx context.Context) (int, error)
func (*HeartbeatStore) CountConfigured ¶ added in v1.2.7
func (s *HeartbeatStore) CountConfigured(ctx context.Context) (int, error)
CountConfigured satisfies the telemetry counter interface uniformly across stores. Paused heartbeats keep active=1; active=0 is delete-pending. See specs/015-shm-telemetry.
func (*HeartbeatStore) CreateHeartbeat ¶
func (s *HeartbeatStore) CreateHeartbeat(ctx context.Context, h *heartbeat.Heartbeat) (string, error)
CreateHeartbeat upserts a heartbeat. Its id is the public ping token: the caller supplies it via h.ID, falling back to a fresh UUID when empty.
func (*HeartbeatStore) DeleteExecutionsBefore ¶
func (*HeartbeatStore) DeleteHeartbeat ¶
func (s *HeartbeatStore) DeleteHeartbeat(ctx context.Context, id string) error
func (*HeartbeatStore) DeletePingsBefore ¶
func (*HeartbeatStore) GetCurrentExecution ¶
func (s *HeartbeatStore) GetCurrentExecution(ctx context.Context, heartbeatID string) (*heartbeat.HeartbeatExecution, error)
GetCurrentExecution returns the latest in-progress execution. Execution ids are time-ordered UUIDv7, so ORDER BY id DESC yields the most recent.
func (*HeartbeatStore) GetHeartbeatByID ¶
func (*HeartbeatStore) GetHeartbeatByUUID ¶
func (s *HeartbeatStore) GetHeartbeatByUUID(ctx context.Context, token string) (*heartbeat.Heartbeat, error)
GetHeartbeatByUUID looks up an active heartbeat by its ping token (the id).
func (*HeartbeatStore) InsertExecution ¶
func (s *HeartbeatStore) InsertExecution(ctx context.Context, e *heartbeat.HeartbeatExecution) (string, error)
func (*HeartbeatStore) InsertPing ¶
func (s *HeartbeatStore) InsertPing(ctx context.Context, p *heartbeat.HeartbeatPing) (string, error)
func (*HeartbeatStore) ListExecutions ¶
func (s *HeartbeatStore) ListExecutions(ctx context.Context, heartbeatID string, opts heartbeat.ListExecutionsOpts) ([]*heartbeat.HeartbeatExecution, int, error)
func (*HeartbeatStore) ListHeartbeats ¶
func (s *HeartbeatStore) ListHeartbeats(ctx context.Context, opts heartbeat.ListHeartbeatsOpts) ([]*heartbeat.Heartbeat, error)
func (*HeartbeatStore) ListOverdueHeartbeats ¶
func (*HeartbeatStore) ListPings ¶
func (s *HeartbeatStore) ListPings(ctx context.Context, heartbeatID string, opts heartbeat.ListPingsOpts) ([]*heartbeat.HeartbeatPing, int, error)
func (*HeartbeatStore) PauseHeartbeat ¶
func (s *HeartbeatStore) PauseHeartbeat(ctx context.Context, id string) error
func (*HeartbeatStore) ResumeHeartbeat ¶
func (*HeartbeatStore) UpdateExecution ¶
func (*HeartbeatStore) UpdateHeartbeat ¶
func (s *HeartbeatStore) UpdateHeartbeat(ctx context.Context, id string, input heartbeat.UpdateHeartbeatInput) error
func (*HeartbeatStore) UpdateHeartbeatState ¶
func (s *HeartbeatStore) UpdateHeartbeatState(ctx context.Context, id string, status heartbeat.HeartbeatStatus, alertState heartbeat.AlertState, lastPingAt *time.Time, nextDeadlineAt *time.Time, currentRunStartedAt *time.Time, lastExitCode *int, lastDurationMs *int64, consecutiveFailures, consecutiveSuccesses int) error
type IncidentStoreImpl ¶
type IncidentStoreImpl struct {
// contains filtered or unexported fields
}
IncidentStoreImpl implements status.IncidentStore using SQLite.
func NewIncidentStore ¶
func NewIncidentStore(d *DB) *IncidentStoreImpl
NewIncidentStore creates a new SQLite-backed incident store.
func (*IncidentStoreImpl) CreateIncident ¶
func (*IncidentStoreImpl) CreateUpdate ¶
func (s *IncidentStoreImpl) CreateUpdate(ctx context.Context, u *status.IncidentUpdate) (string, error)
func (*IncidentStoreImpl) DeleteIncident ¶
func (s *IncidentStoreImpl) DeleteIncident(ctx context.Context, id string) error
func (*IncidentStoreImpl) DeleteIncidentsOlderThan ¶
func (*IncidentStoreImpl) GetActiveIncidentByComponent ¶
func (*IncidentStoreImpl) GetIncident ¶
func (*IncidentStoreImpl) ListActiveIncidents ¶
func (*IncidentStoreImpl) ListIncidents ¶
func (s *IncidentStoreImpl) ListIncidents(ctx context.Context, opts status.ListIncidentsOpts) ([]status.Incident, int, error)
func (*IncidentStoreImpl) ListRecentIncidents ¶
func (*IncidentStoreImpl) ListUpdates ¶
func (s *IncidentStoreImpl) ListUpdates(ctx context.Context, incidentID string) ([]status.IncidentUpdate, error)
func (*IncidentStoreImpl) UpdateIncident ¶
type KubernetesStore ¶ added in v1.3.0
type KubernetesStore struct {
// contains filtered or unexported fields
}
KubernetesStore persists per-agent Kubernetes topology (namespaces, workloads, pods, nodes). Each Replace*ForAgent reconciles the snapshot it is given, upserting present rows and hard-deleting the agent's rows that are gone.
func NewKubernetesStore ¶ added in v1.3.0
func NewKubernetesStore(d *DB) *KubernetesStore
NewKubernetesStore creates a SQLite-backed Kubernetes topology store.
func (*KubernetesStore) GetPod ¶ added in v1.3.0
func (s *KubernetesStore) GetPod(ctx context.Context, agentID, namespace, name string) (*kubernetes.K8sPod, error)
GetPod returns a single pod by namespace and name, or nil if absent.
func (*KubernetesStore) GetWorkload ¶ added in v1.3.0
func (s *KubernetesStore) GetWorkload(ctx context.Context, agentID, workloadID string) (*kubernetes.K8sWorkload, error)
GetWorkload returns a single workload by its natural id, or nil if absent.
func (*KubernetesStore) ListEventsForObject ¶ added in v1.3.0
func (s *KubernetesStore) ListEventsForObject(ctx context.Context, agentID, kind, namespace, name string) ([]kubernetes.K8sEvent, error)
ListEventsForObject returns the agent's events concerning a single object (e.g. a Pod or a Deployment), newest first.
func (*KubernetesStore) ListNamespaces ¶ added in v1.3.0
ListNamespaces returns the agent's namespaces sorted by name. agentID empty returns every agent's namespaces (deduplicated).
func (*KubernetesStore) ListNodes ¶ added in v1.3.0
func (s *KubernetesStore) ListNodes(ctx context.Context, agentID string) ([]kubernetes.K8sNode, error)
ListNodes returns the agent's nodes sorted by name.
func (*KubernetesStore) ListPods ¶ added in v1.3.0
func (s *KubernetesStore) ListPods(ctx context.Context, agentID string, namespaces []string, filters kubernetes.PodFilters) ([]kubernetes.K8sPod, error)
ListPods returns the agent's pods, optionally filtered by namespaces and the workload/node/status filters.
func (*KubernetesStore) ListWorkloads ¶ added in v1.3.0
func (s *KubernetesStore) ListWorkloads(ctx context.Context, agentID string, namespaces []string) ([]kubernetes.K8sWorkloadGroup, error)
ListWorkloads returns the agent's workloads grouped by namespace, optionally restricted to the given namespaces.
func (*KubernetesStore) ReplaceEventsForAgent ¶ added in v1.3.0
func (s *KubernetesStore) ReplaceEventsForAgent(ctx context.Context, agentID string, events []kubernetes.K8sEventRef) error
ReplaceEventsForAgent replaces the agent's events wholesale. Events are ephemeral (the agent reports its current event window each snapshot), so the snapshot fully supersedes the stored set: wipe the agent's rows, then insert.
func (*KubernetesStore) ReplaceNamespacesForAgent ¶ added in v1.3.0
func (s *KubernetesStore) ReplaceNamespacesForAgent(ctx context.Context, agentID string, namespaces []string) error
ReplaceNamespacesForAgent replaces the agent's namespace list wholesale. Namespaces carry no mutable fields beyond their key, so the snapshot fully supersedes the stored set: wipe the agent's rows, then insert the new set.
func (*KubernetesStore) ReplaceNodesForAgent ¶ added in v1.3.0
func (s *KubernetesStore) ReplaceNodesForAgent(ctx context.Context, agentID string, nodes []kubernetes.K8sNode) error
ReplaceNodesForAgent reconciles the agent's nodes.
func (*KubernetesStore) ReplacePodsForAgent ¶ added in v1.3.0
func (s *KubernetesStore) ReplacePodsForAgent(ctx context.Context, agentID string, pods []kubernetes.K8sPod) error
ReplacePodsForAgent reconciles the agent's pods.
func (*KubernetesStore) ReplaceWorkloadsForAgent ¶ added in v1.3.0
func (s *KubernetesStore) ReplaceWorkloadsForAgent(ctx context.Context, agentID string, workloads []kubernetes.K8sWorkload) error
ReplaceWorkloadsForAgent reconciles the agent's workloads.
type MCPOAuthStoreImpl ¶
type MCPOAuthStoreImpl struct {
// contains filtered or unexported fields
}
MCPOAuthStoreImpl implements oauth.MCPOAuthStore using SQLite.
func NewMCPOAuthStore ¶
func NewMCPOAuthStore(d *DB) *MCPOAuthStoreImpl
NewMCPOAuthStore creates a new SQLite-backed MCP OAuth store.
func (*MCPOAuthStoreImpl) ConsumeCode ¶
func (s *MCPOAuthStoreImpl) ConsumeCode(ctx context.Context, codeHash string) (*oauth.MCPAuthCode, error)
func (*MCPOAuthStoreImpl) DeleteExpired ¶
func (s *MCPOAuthStoreImpl) DeleteExpired(ctx context.Context) (int64, error)
func (*MCPOAuthStoreImpl) GetToken ¶
func (s *MCPOAuthStoreImpl) GetToken(ctx context.Context, tokenHash string) (*oauth.MCPOAuthToken, error)
func (*MCPOAuthStoreImpl) RevokeFamily ¶
func (s *MCPOAuthStoreImpl) RevokeFamily(ctx context.Context, familyID string) error
func (*MCPOAuthStoreImpl) RevokeToken ¶
func (s *MCPOAuthStoreImpl) RevokeToken(ctx context.Context, tokenHash string) error
func (*MCPOAuthStoreImpl) StoreCode ¶
func (s *MCPOAuthStoreImpl) StoreCode(ctx context.Context, code *oauth.MCPAuthCode) error
func (*MCPOAuthStoreImpl) StoreToken ¶
func (s *MCPOAuthStoreImpl) StoreToken(ctx context.Context, token *oauth.MCPOAuthToken) error
type MaintenanceStoreImpl ¶
type MaintenanceStoreImpl struct {
// contains filtered or unexported fields
}
MaintenanceStoreImpl implements status.MaintenanceStore using SQLite.
func NewMaintenanceStore ¶
func NewMaintenanceStore(d *DB) *MaintenanceStoreImpl
NewMaintenanceStore creates a new SQLite-backed maintenance store.
func (*MaintenanceStoreImpl) CreateMaintenance ¶
func (s *MaintenanceStoreImpl) CreateMaintenance(ctx context.Context, mw *status.MaintenanceWindow, componentIDs []string) (string, error)
func (*MaintenanceStoreImpl) DeleteMaintenance ¶
func (s *MaintenanceStoreImpl) DeleteMaintenance(ctx context.Context, id string) error
func (*MaintenanceStoreImpl) GetMaintenance ¶
func (s *MaintenanceStoreImpl) GetMaintenance(ctx context.Context, id string) (*status.MaintenanceWindow, error)
func (*MaintenanceStoreImpl) GetPendingActivation ¶
func (s *MaintenanceStoreImpl) GetPendingActivation(ctx context.Context, now int64) ([]status.MaintenanceWindow, error)
func (*MaintenanceStoreImpl) GetPendingDeactivation ¶
func (s *MaintenanceStoreImpl) GetPendingDeactivation(ctx context.Context, now int64) ([]status.MaintenanceWindow, error)
func (*MaintenanceStoreImpl) IsEntitySuppressed ¶ added in v1.2.12
func (s *MaintenanceStoreImpl) IsEntitySuppressed( ctx context.Context, monitorType string, monitorID string, now time.Time, ) (matched bool, windowID string, endsAt time.Time, err error)
IsEntitySuppressed returns true (with the matching window ID and end time) if at least one active maintenance window currently covers the given monitor. Active means starts_at ≤ now < ends_at regardless of the window's `active` flag (which controls Status Page display, not suppressor logic).
func (*MaintenanceStoreImpl) ListMaintenance ¶
func (s *MaintenanceStoreImpl) ListMaintenance(ctx context.Context, statusFilter string, limit int) ([]status.MaintenanceWindow, error)
func (*MaintenanceStoreImpl) UpdateMaintenance ¶
func (s *MaintenanceStoreImpl) UpdateMaintenance(ctx context.Context, mw *status.MaintenanceWindow, componentIDs []string) error
type PersonalizationStoreImpl ¶ added in v1.2.11
type PersonalizationStoreImpl struct {
// contains filtered or unexported fields
}
func NewPersonalizationStore ¶ added in v1.2.11
func NewPersonalizationStore(d *DB) *PersonalizationStoreImpl
func (*PersonalizationStoreImpl) BumpVersion ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) BumpVersion(ctx context.Context) error
func (*PersonalizationStoreImpl) CreateFAQItem ¶ added in v1.2.11
func (*PersonalizationStoreImpl) CreateFooterLink ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) CreateFooterLink(ctx context.Context, label, url string) (status.FooterLink, error)
func (*PersonalizationStoreImpl) DeleteAsset ¶ added in v1.2.11
func (*PersonalizationStoreImpl) DeleteFAQItem ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) DeleteFAQItem(ctx context.Context, id string) error
func (*PersonalizationStoreImpl) DeleteFooterLink ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) DeleteFooterLink(ctx context.Context, id string) error
func (*PersonalizationStoreImpl) GetSettings ¶ added in v1.2.11
func (*PersonalizationStoreImpl) ListFAQItems ¶ added in v1.2.11
func (*PersonalizationStoreImpl) ListFooterLinks ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) ListFooterLinks(ctx context.Context) ([]status.FooterLink, error)
func (*PersonalizationStoreImpl) ReorderFAQItems ¶ added in v1.2.11
func (*PersonalizationStoreImpl) ReorderFooterLinks ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) ReorderFooterLinks(ctx context.Context, ids []string) ([]status.FooterLink, error)
func (*PersonalizationStoreImpl) UpdateFAQItem ¶ added in v1.2.11
func (*PersonalizationStoreImpl) UpdateFooterLink ¶ added in v1.2.11
func (s *PersonalizationStoreImpl) UpdateFooterLink(ctx context.Context, id string, label, url string) (status.FooterLink, error)
func (*PersonalizationStoreImpl) UpdateSettings ¶ added in v1.2.11
type ResourceStore ¶
type ResourceStore struct {
// contains filtered or unexported fields
}
ResourceStore implements resource.ResourceStore using SQLite.
func NewResourceStore ¶
func NewResourceStore(d *DB) *ResourceStore
NewResourceStore creates a new SQLite-backed resource store.
func (*ResourceStore) AggregateDailyRollup ¶
func (*ResourceStore) AggregateHourlyRollup ¶
func (*ResourceStore) DeleteDailyBefore ¶
func (*ResourceStore) DeleteHourlyBefore ¶
func (*ResourceStore) DeleteSnapshotsBefore ¶
func (*ResourceStore) GetAlertConfig ¶
func (s *ResourceStore) GetAlertConfig(ctx context.Context, containerID string) (*resource.ResourceAlertConfig, error)
func (*ResourceStore) GetLatestSnapshot ¶
func (s *ResourceStore) GetLatestSnapshot(ctx context.Context, containerID string) (*resource.ResourceSnapshot, error)
func (*ResourceStore) GetTopConsumersByPeriod ¶
func (s *ResourceStore) GetTopConsumersByPeriod(ctx context.Context, metric string, period string, limit int, agentID *string) ([]resource.TopConsumerRow, error)
GetTopConsumersByPeriod ranks containers by average resource usage over a period. agentID filters by host: nil = all hosts, a pointer to "" = the local server (containers owned by the LocalAgent sentinel), a pointer to an id = that agent.
func (*ResourceStore) InsertDailyRollup ¶
func (*ResourceStore) InsertHourlyRollup ¶
func (*ResourceStore) InsertSnapshot ¶
func (s *ResourceStore) InsertSnapshot(ctx context.Context, snap *resource.ResourceSnapshot) (string, error)
func (*ResourceStore) ListSnapshots ¶
func (s *ResourceStore) ListSnapshots(ctx context.Context, containerID string, from, to time.Time) ([]*resource.ResourceSnapshot, error)
func (*ResourceStore) ListSnapshotsAggregated ¶
func (s *ResourceStore) ListSnapshotsAggregated(ctx context.Context, containerID string, from, to time.Time, granularity resource.Granularity) ([]*resource.ResourceSnapshot, error)
func (*ResourceStore) UpsertAlertConfig ¶
func (s *ResourceStore) UpsertAlertConfig(ctx context.Context, cfg *resource.ResourceAlertConfig) error
type RetentionOpts ¶
type RetentionOpts struct {
EndpointStore *EndpointStore
HeartbeatStore *HeartbeatStore
CertificateStore *CertificateStore
ResourceStore *ResourceStore
}
RetentionOpts holds optional stores for retention cleanup.
type SilenceStoreImpl ¶
type SilenceStoreImpl struct {
// contains filtered or unexported fields
}
SilenceStoreImpl implements alert.SilenceStore using SQLite.
func NewSilenceStore ¶
func NewSilenceStore(d *DB) *SilenceStoreImpl
NewSilenceStore creates a new SQLite-backed silence store.
func (*SilenceStoreImpl) CancelSilenceRule ¶
func (s *SilenceStoreImpl) CancelSilenceRule(ctx context.Context, id string) error
func (*SilenceStoreImpl) GetActiveSilenceRules ¶
func (s *SilenceStoreImpl) GetActiveSilenceRules(ctx context.Context) ([]*alert.SilenceRule, error)
func (*SilenceStoreImpl) InsertSilenceRule ¶
func (s *SilenceStoreImpl) InsertSilenceRule(ctx context.Context, rule *alert.SilenceRule) (string, error)
func (*SilenceStoreImpl) ListSilenceRules ¶
func (s *SilenceStoreImpl) ListSilenceRules(ctx context.Context, activeOnly bool) ([]*alert.SilenceRule, error)
type StatusComponentStoreImpl ¶
type StatusComponentStoreImpl struct {
// contains filtered or unexported fields
}
StatusComponentStoreImpl implements status.ComponentStore using SQLite.
func NewStatusComponentStore ¶
func NewStatusComponentStore(d *DB) *StatusComponentStoreImpl
NewStatusComponentStore creates a new SQLite-backed component store.
func (*StatusComponentStoreImpl) CountConfigured ¶ added in v1.2.7
func (s *StatusComponentStoreImpl) CountConfigured(ctx context.Context) (int, error)
CountConfigured returns the number of operator-configured status-page components. The table uses hard-delete only, so no soft-delete filter is needed. Used by the telemetry subsystem; see specs/015-shm-telemetry.
func (*StatusComponentStoreImpl) CreateComponent ¶
func (*StatusComponentStoreImpl) DeleteComponent ¶
func (s *StatusComponentStoreImpl) DeleteComponent(ctx context.Context, id string) error
func (*StatusComponentStoreImpl) GetComponent ¶
func (*StatusComponentStoreImpl) ListComponents ¶
func (*StatusComponentStoreImpl) ListComponentsByMonitor ¶ added in v1.2.11
func (*StatusComponentStoreImpl) ListVisibleComponents ¶
func (*StatusComponentStoreImpl) RemoveDanglingMonitorRefs ¶ added in v1.2.11
func (*StatusComponentStoreImpl) UpdateComponent ¶
type SubscriberStoreImpl ¶
type SubscriberStoreImpl struct {
// contains filtered or unexported fields
}
SubscriberStoreImpl implements status.SubscriberStore using SQLite.
func NewSubscriberStore ¶
func NewSubscriberStore(d *DB) *SubscriberStoreImpl
NewSubscriberStore creates a new SQLite-backed subscriber store.
func (*SubscriberStoreImpl) CleanExpiredUnconfirmed ¶
func (s *SubscriberStoreImpl) CleanExpiredUnconfirmed(ctx context.Context) (int64, error)
func (*SubscriberStoreImpl) ConfirmSubscriber ¶
func (s *SubscriberStoreImpl) ConfirmSubscriber(ctx context.Context, id string) error
func (*SubscriberStoreImpl) CreateSubscriber ¶
func (s *SubscriberStoreImpl) CreateSubscriber(ctx context.Context, sub *status.StatusSubscriber) (string, error)
func (*SubscriberStoreImpl) DeleteSubscriber ¶
func (s *SubscriberStoreImpl) DeleteSubscriber(ctx context.Context, id string) error
func (*SubscriberStoreImpl) GetSubscriberByToken ¶
func (s *SubscriberStoreImpl) GetSubscriberByToken(ctx context.Context, confirmToken string) (*status.StatusSubscriber, error)
func (*SubscriberStoreImpl) GetSubscriberByUnsubToken ¶
func (s *SubscriberStoreImpl) GetSubscriberByUnsubToken(ctx context.Context, unsubToken string) (*status.StatusSubscriber, error)
func (*SubscriberStoreImpl) GetSubscriberStats ¶
func (s *SubscriberStoreImpl) GetSubscriberStats(ctx context.Context) (*status.SubscriberStats, error)
func (*SubscriberStoreImpl) ListConfirmedSubscribers ¶
func (s *SubscriberStoreImpl) ListConfirmedSubscribers(ctx context.Context) ([]status.StatusSubscriber, error)
func (*SubscriberStoreImpl) ListSubscribers ¶
func (s *SubscriberStoreImpl) ListSubscribers(ctx context.Context) ([]status.StatusSubscriber, error)
type SwarmNodeStore ¶ added in v1.2.0
type SwarmNodeStore struct {
// contains filtered or unexported fields
}
SwarmNodeStore implements swarm node persistence using SQLite.
func NewSwarmNodeStore ¶ added in v1.2.0
func NewSwarmNodeStore(d *DB) *SwarmNodeStore
NewSwarmNodeStore creates a new SQLite-backed swarm node store.
func (*SwarmNodeStore) GetNodeByNodeID ¶ added in v1.2.0
func (s *SwarmNodeStore) GetNodeByNodeID(ctx context.Context, nodeID string) (*swarm.SwarmNode, error)
GetNodeByNodeID returns a single swarm node by its Docker node ID.
func (*SwarmNodeStore) ListNodes ¶ added in v1.2.0
ListNodes returns swarm nodes. When agentID is non-empty only that agent's nodes are returned; otherwise every agent's nodes are returned.
func (*SwarmNodeStore) ReplaceNodesForAgent ¶ added in v1.3.0
func (s *SwarmNodeStore) ReplaceNodesForAgent(ctx context.Context, agentID string, nodes []*swarm.SwarmNode) error
ReplaceNodesForAgent upserts every node in the snapshot and hard-deletes any node previously held for this agent that is no longer present. first_seen_at is preserved across upserts by UpsertNode.
func (*SwarmNodeStore) UpdateNodeStatus ¶ added in v1.2.0
func (s *SwarmNodeStore) UpdateNodeStatus(ctx context.Context, nodeID, status, availability string) error
UpdateNodeStatus updates the status and availability of a swarm node.
func (*SwarmNodeStore) UpdateNodeTaskCount ¶ added in v1.2.0
UpdateNodeTaskCount updates the task count for a swarm node.
func (*SwarmNodeStore) UpsertNode ¶ added in v1.2.0
UpsertNode inserts or updates a swarm node. Its id is derived deterministically from (agent_id, node_id) so the agent and server mint the same id.
type SwarmTopologyStore ¶ added in v1.3.0
type SwarmTopologyStore struct {
// contains filtered or unexported fields
}
SwarmTopologyStore persists per-agent swarm services and tasks. Nodes live in SwarmNodeStore. All three are reconciled together by the ingest service: each snapshot upserts the rows it carries and hard-deletes the agent's rows that are absent from it.
func NewSwarmTopologyStore ¶ added in v1.3.0
func NewSwarmTopologyStore(d *DB) *SwarmTopologyStore
NewSwarmTopologyStore creates a SQLite-backed swarm topology store.
func (*SwarmTopologyStore) ListServices ¶ added in v1.3.0
func (s *SwarmTopologyStore) ListServices(ctx context.Context, agentID string) ([]*swarm.SwarmService, error)
ListServices returns swarm services. When agentID is non-empty only that agent's services are returned; otherwise every agent's services are returned.
func (*SwarmTopologyStore) ListTasks ¶ added in v1.3.0
func (s *SwarmTopologyStore) ListTasks(ctx context.Context, agentID, serviceID string) ([]*swarm.SwarmTask, error)
ListTasks returns swarm tasks. agentID and serviceID are optional filters (empty = no filter on that dimension).
func (*SwarmTopologyStore) ReplaceServicesForAgent ¶ added in v1.3.0
func (s *SwarmTopologyStore) ReplaceServicesForAgent(ctx context.Context, agentID string, services []swarm.SwarmService) error
ReplaceServicesForAgent upserts every service in the snapshot and hard-deletes any service previously held for this agent that is no longer present.
func (*SwarmTopologyStore) ReplaceTasksForAgent ¶ added in v1.3.0
func (s *SwarmTopologyStore) ReplaceTasksForAgent(ctx context.Context, agentID string, tasks []swarm.SwarmTask) error
ReplaceTasksForAgent upserts every task in the snapshot and hard-deletes any task previously held for this agent that is no longer present.
type TriggerStoreImpl ¶ added in v1.2.12
type TriggerStoreImpl struct {
// contains filtered or unexported fields
}
TriggerStoreImpl implements alert.TriggerStore using SQLite.
func NewTriggerStore ¶ added in v1.2.12
func NewTriggerStore(d *DB) *TriggerStoreImpl
NewTriggerStore creates a new SQLite-backed trigger store.
func (*TriggerStoreImpl) DeleteTrigger ¶ added in v1.2.12
func (s *TriggerStoreImpl) DeleteTrigger(ctx context.Context, id string) error
func (*TriggerStoreImpl) GetTrigger ¶ added in v1.2.12
func (s *TriggerStoreImpl) GetTrigger(ctx context.Context, id string) (*alert.AlertTrigger, error)
func (*TriggerStoreImpl) InsertTrigger ¶ added in v1.2.12
func (s *TriggerStoreImpl) InsertTrigger(ctx context.Context, t *alert.AlertTrigger) (string, error)
func (*TriggerStoreImpl) ListChannelsForTrigger ¶ added in v1.2.12
func (*TriggerStoreImpl) ListEnabledTriggers ¶ added in v1.2.12
func (s *TriggerStoreImpl) ListEnabledTriggers(ctx context.Context) ([]*alert.AlertTrigger, error)
func (*TriggerStoreImpl) ListTriggers ¶ added in v1.2.12
func (s *TriggerStoreImpl) ListTriggers(ctx context.Context) ([]*alert.AlertTrigger, error)
func (*TriggerStoreImpl) ListTriggersForChannel ¶ added in v1.2.12
func (s *TriggerStoreImpl) ListTriggersForChannel(ctx context.Context, channelID string) ([]*alert.AlertTrigger, error)
func (*TriggerStoreImpl) SetChannels ¶ added in v1.2.12
func (s *TriggerStoreImpl) SetChannels(ctx context.Context, triggerID string, channelIDs []string) error
SetChannels replaces all channel links for a trigger atomically (within the writer's serialization guarantee).
func (*TriggerStoreImpl) UpdateTrigger ¶ added in v1.2.12
func (s *TriggerStoreImpl) UpdateTrigger(ctx context.Context, t *alert.AlertTrigger) error
type UpdateStore ¶
type UpdateStore struct {
// contains filtered or unexported fields
}
UpdateStore implements update.UpdateStore using SQLite.
func NewUpdateStore ¶
func NewUpdateStore(d *DB) *UpdateStore
NewUpdateStore creates a new SQLite-backed update store.
func (*UpdateStore) CleanupExpired ¶
func (*UpdateStore) DeleteContainerCVEs ¶
func (s *UpdateStore) DeleteContainerCVEs(ctx context.Context, containerID string) error
func (*UpdateStore) DeleteExclusion ¶
func (s *UpdateStore) DeleteExclusion(ctx context.Context, id string) error
func (*UpdateStore) DeleteImageUpdatesByContainer ¶
func (s *UpdateStore) DeleteImageUpdatesByContainer(ctx context.Context, containerID string) error
func (*UpdateStore) DeleteStaleImageUpdates ¶ added in v1.1.0
func (*UpdateStore) DeleteVersionPin ¶
func (s *UpdateStore) DeleteVersionPin(ctx context.Context, containerID string) error
func (*UpdateStore) GetCVECacheEntries ¶
func (s *UpdateStore) GetCVECacheEntries(ctx context.Context, ecosystem, packageName, packageVersion string) ([]*update.CVECacheEntry, error)
func (*UpdateStore) GetCVESummaryCounts ¶
func (*UpdateStore) GetDigestBaseline ¶ added in v1.1.2
func (s *UpdateStore) GetDigestBaseline(ctx context.Context, containerID string) (*update.DigestBaseline, error)
GetDigestBaseline returns the stored digest baseline for a container.
func (*UpdateStore) GetImageUpdate ¶
func (s *UpdateStore) GetImageUpdate(ctx context.Context, id string) (*update.ImageUpdate, error)
func (*UpdateStore) GetImageUpdateByContainer ¶
func (s *UpdateStore) GetImageUpdateByContainer(ctx context.Context, containerID string) (*update.ImageUpdate, error)
func (*UpdateStore) GetLatestScanRecord ¶
func (s *UpdateStore) GetLatestScanRecord(ctx context.Context) (*update.ScanRecord, error)
func (*UpdateStore) GetScanRecord ¶
func (s *UpdateStore) GetScanRecord(ctx context.Context, id string) (*update.ScanRecord, error)
func (*UpdateStore) GetUpdateSummary ¶
func (s *UpdateStore) GetUpdateSummary(ctx context.Context) (*update.UpdateSummary, error)
func (*UpdateStore) GetVersionPin ¶
func (s *UpdateStore) GetVersionPin(ctx context.Context, containerID string) (*update.VersionPin, error)
func (*UpdateStore) InsertCVECacheEntry ¶
func (s *UpdateStore) InsertCVECacheEntry(ctx context.Context, e *update.CVECacheEntry) (string, error)
func (*UpdateStore) InsertExclusion ¶
func (s *UpdateStore) InsertExclusion(ctx context.Context, e *update.UpdateExclusion) (string, error)
func (*UpdateStore) InsertImageUpdate ¶
func (s *UpdateStore) InsertImageUpdate(ctx context.Context, u *update.ImageUpdate) (string, error)
func (*UpdateStore) InsertRiskScoreRecord ¶
func (s *UpdateStore) InsertRiskScoreRecord(ctx context.Context, r *update.RiskScoreRecord) (string, error)
func (*UpdateStore) InsertScanRecord ¶
func (s *UpdateStore) InsertScanRecord(ctx context.Context, r *update.ScanRecord) (string, error)
func (*UpdateStore) InsertVersionPin ¶
func (s *UpdateStore) InsertVersionPin(ctx context.Context, p *update.VersionPin) (string, error)
func (*UpdateStore) IsCVECacheFresh ¶
func (*UpdateStore) ListAllActiveCVEs ¶
func (s *UpdateStore) ListAllActiveCVEs(ctx context.Context, opts update.ListCVEsOpts) ([]*update.ContainerCVE, error)
func (*UpdateStore) ListContainerCVEs ¶
func (s *UpdateStore) ListContainerCVEs(ctx context.Context, containerID string) ([]*update.ContainerCVE, error)
func (*UpdateStore) ListExclusions ¶
func (s *UpdateStore) ListExclusions(ctx context.Context) ([]*update.UpdateExclusion, error)
func (*UpdateStore) ListImageUpdates ¶
func (s *UpdateStore) ListImageUpdates(ctx context.Context, opts update.ListImageUpdatesOpts) ([]*update.ImageUpdate, error)
func (*UpdateStore) ListRiskScoreHistory ¶
func (s *UpdateStore) ListRiskScoreHistory(ctx context.Context, containerID string, from, to time.Time) ([]*update.RiskScoreRecord, error)
func (*UpdateStore) ListStaleImageUpdates ¶ added in v1.2.12
func (s *UpdateStore) ListStaleImageUpdates(ctx context.Context, scanID string, scannedContainerNames []string) ([]update.StaleImageUpdate, error)
ListStaleImageUpdates returns the containers that had a pending update before this scan but are no longer in the latest results — i.e. containers that were upgraded between scans. The container id is returned alongside the name so the recovery event can resolve the alert by its real entity id.
func (*UpdateStore) ResolveContainerCVE ¶
func (s *UpdateStore) ResolveContainerCVE(ctx context.Context, containerID, cveID string) error
func (*UpdateStore) UpdateImageUpdate ¶
func (s *UpdateStore) UpdateImageUpdate(ctx context.Context, u *update.ImageUpdate) error
func (*UpdateStore) UpdateScanRecord ¶
func (s *UpdateStore) UpdateScanRecord(ctx context.Context, r *update.ScanRecord) error
func (*UpdateStore) UpsertContainerCVE ¶
func (s *UpdateStore) UpsertContainerCVE(ctx context.Context, c *update.ContainerCVE) error
func (*UpdateStore) UpsertDigestBaseline ¶ added in v1.1.2
func (s *UpdateStore) UpsertDigestBaseline(ctx context.Context, b *update.DigestBaseline) error
UpsertDigestBaseline inserts or updates the digest baseline for a container.
type UptimeDailyStore ¶
type UptimeDailyStore struct {
// contains filtered or unexported fields
}
UptimeDailyStore provides daily uptime aggregation queries.
func NewUptimeDailyStore ¶
func NewUptimeDailyStore(d *DB) *UptimeDailyStore
NewUptimeDailyStore creates a new daily uptime store.
func (*UptimeDailyStore) GetContainerDailyUptime ¶ added in v1.3.2
func (s *UptimeDailyStore) GetContainerDailyUptime(ctx context.Context, containerID string, days int) ([]DailyUptime, error)
GetContainerDailyUptime computes a per-day, time-weighted uptime series for a container from its state transitions. Unlike endpoints/heartbeats (discrete checks), container uptime is the running+healthy fraction of each day. Days before the first recorded transition return nil (no data), most recent first.
func (*UptimeDailyStore) GetEndpointDailyUptime ¶
func (s *UptimeDailyStore) GetEndpointDailyUptime(ctx context.Context, endpointID string, days int) ([]DailyUptime, error)
GetEndpointDailyUptime aggregates endpoint check results by UTC day. Returns up to `days` days of data, most recent first. Days with no checks have UptimePercent = nil.
func (*UptimeDailyStore) GetHeartbeatDailyUptime ¶
func (s *UptimeDailyStore) GetHeartbeatDailyUptime(ctx context.Context, heartbeatID string, days int) ([]DailyUptime, error)
GetHeartbeatDailyUptime aggregates heartbeat pings by UTC day. Returns up to `days` days of data, most recent first. Days with no pings have UptimePercent = nil.
type WebhookStoreImpl ¶
type WebhookStoreImpl struct {
// contains filtered or unexported fields
}
WebhookStoreImpl implements webhook.WebhookSubscriptionStore using SQLite.
func NewWebhookStore ¶
func NewWebhookStore(d *DB) *WebhookStoreImpl
NewWebhookStore creates a new SQLite-backed webhook subscription store.
func (*WebhookStoreImpl) CountConfigured ¶ added in v1.2.7
func (s *WebhookStoreImpl) CountConfigured(ctx context.Context) (int, error)
CountConfigured returns the number of operator-configured webhook subscriptions. is_active=0 means operator-paused (still counted per spec). Used by the telemetry subsystem; see specs/015-shm-telemetry.
func (*WebhookStoreImpl) Create ¶
func (s *WebhookStoreImpl) Create(ctx context.Context, sub *webhook.WebhookSubscription) error
func (*WebhookStoreImpl) Delete ¶
func (s *WebhookStoreImpl) Delete(ctx context.Context, id string) error
func (*WebhookStoreImpl) GetByID ¶
func (s *WebhookStoreImpl) GetByID(ctx context.Context, id string) (*webhook.WebhookSubscription, error)
func (*WebhookStoreImpl) List ¶
func (s *WebhookStoreImpl) List(ctx context.Context) ([]*webhook.WebhookSubscription, error)
func (*WebhookStoreImpl) ListActive ¶
func (s *WebhookStoreImpl) ListActive(ctx context.Context) ([]*webhook.WebhookSubscription, error)
func (*WebhookStoreImpl) UpdateDeliveryStatus ¶
type WriteOp ¶
type WriteOp struct {
Query string
Args []interface{}
Fn func(context.Context, *sql.Tx) error
Done chan WriteResult
}
WriteOp represents a single write operation to be serialized. When Fn is set, it runs inside a transaction on the writer goroutine and Query/Args are ignored.
type WriteResult ¶
WriteResult contains the result of a write operation.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer serializes all database writes through a single goroutine.
func (*Writer) Tx ¶ added in v1.3.0
Tx runs fn inside a single transaction executed on the writer goroutine, so the whole read-modify-write is serialized against every other write — no other write can interleave between fn's reads and its writes. fn must use the provided *sql.Tx for all statements; calling Exec/Tx from within fn deadlocks.
Source Files
¶
- acknowledgments.go
- agents.go
- alerts.go
- certificates.go
- channels.go
- containers.go
- db.go
- endpoints.go
- escalation.go
- heartbeats.go
- helpers.go
- incidents.go
- kubernetes.go
- maintenance.go
- mcp_oauth.go
- migrations.go
- resources.go
- retention.go
- silence.go
- status_components.go
- status_personalization_store.go
- subscribers.go
- swarm_node.go
- swarm_topology.go
- transform.go
- transform_cert_sni.go
- triggers.go
- updates.go
- uptime_daily.go
- webhook.go
- writer.go