forked from wrenn/wrenn
- New sandbox_metrics_snapshots table sampled every 10s (60-day retention) - Background MetricsSampler goroutine wired into control plane startup - GET /v1/sandboxes/stats?range=5m|1h|6h|24h|30d endpoint with adaptive polling intervals; reserved CPU/RAM uses ceil(paused/2) formula - StatsPanel component: 4 stat cards + 2 Chart.js line charts (straight lines, integer y-axis for running count, dual-axis for CPU/RAM) - Range filter persisted in URL query param; polls update data silently (no blink — loading state only shown on initial mount) - Split /dashboard/capsules into /list and /stats sub-routes with shared layout; capsuleRunningCount store syncs badge across routes - CreateCapsuleDialog extracted as reusable component
158 lines
5.7 KiB
Go
158 lines
5.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
|
|
package db
|
|
|
|
import (
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type AdminPermission struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
Permission string `json:"permission"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type AuditLog struct {
|
|
ID string `json:"id"`
|
|
TeamID string `json:"team_id"`
|
|
ActorType string `json:"actor_type"`
|
|
ActorID pgtype.Text `json:"actor_id"`
|
|
ActorName pgtype.Text `json:"actor_name"`
|
|
ResourceType string `json:"resource_type"`
|
|
ResourceID pgtype.Text `json:"resource_id"`
|
|
Action string `json:"action"`
|
|
Scope string `json:"scope"`
|
|
Status string `json:"status"`
|
|
Metadata []byte `json:"metadata"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Host struct {
|
|
ID string `json:"id"`
|
|
Type string `json:"type"`
|
|
TeamID pgtype.Text `json:"team_id"`
|
|
Provider pgtype.Text `json:"provider"`
|
|
AvailabilityZone pgtype.Text `json:"availability_zone"`
|
|
Arch pgtype.Text `json:"arch"`
|
|
CpuCores pgtype.Int4 `json:"cpu_cores"`
|
|
MemoryMb pgtype.Int4 `json:"memory_mb"`
|
|
DiskGb pgtype.Int4 `json:"disk_gb"`
|
|
Address pgtype.Text `json:"address"`
|
|
Status string `json:"status"`
|
|
LastHeartbeatAt pgtype.Timestamptz `json:"last_heartbeat_at"`
|
|
Metadata []byte `json:"metadata"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
CertFingerprint pgtype.Text `json:"cert_fingerprint"`
|
|
MtlsEnabled bool `json:"mtls_enabled"`
|
|
}
|
|
|
|
type HostRefreshToken struct {
|
|
ID string `json:"id"`
|
|
HostID string `json:"host_id"`
|
|
TokenHash string `json:"token_hash"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
RevokedAt pgtype.Timestamptz `json:"revoked_at"`
|
|
}
|
|
|
|
type HostTag struct {
|
|
HostID string `json:"host_id"`
|
|
Tag string `json:"tag"`
|
|
}
|
|
|
|
type HostToken struct {
|
|
ID string `json:"id"`
|
|
HostID string `json:"host_id"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
UsedAt pgtype.Timestamptz `json:"used_at"`
|
|
}
|
|
|
|
type OauthProvider struct {
|
|
Provider string `json:"provider"`
|
|
ProviderID string `json:"provider_id"`
|
|
UserID string `json:"user_id"`
|
|
Email string `json:"email"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Sandbox struct {
|
|
ID string `json:"id"`
|
|
HostID string `json:"host_id"`
|
|
Template string `json:"template"`
|
|
Status string `json:"status"`
|
|
Vcpus int32 `json:"vcpus"`
|
|
MemoryMb int32 `json:"memory_mb"`
|
|
TimeoutSec int32 `json:"timeout_sec"`
|
|
GuestIp string `json:"guest_ip"`
|
|
HostIp string `json:"host_ip"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
LastActiveAt pgtype.Timestamptz `json:"last_active_at"`
|
|
LastUpdated pgtype.Timestamptz `json:"last_updated"`
|
|
TeamID string `json:"team_id"`
|
|
}
|
|
|
|
type SandboxMetricsSnapshot struct {
|
|
ID int64 `json:"id"`
|
|
TeamID string `json:"team_id"`
|
|
SampledAt pgtype.Timestamptz `json:"sampled_at"`
|
|
RunningCount int32 `json:"running_count"`
|
|
VcpusReserved int32 `json:"vcpus_reserved"`
|
|
MemoryMbReserved int32 `json:"memory_mb_reserved"`
|
|
}
|
|
|
|
type Team struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
IsByoc bool `json:"is_byoc"`
|
|
Slug string `json:"slug"`
|
|
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
|
|
}
|
|
|
|
type TeamApiKey struct {
|
|
ID string `json:"id"`
|
|
TeamID string `json:"team_id"`
|
|
Name string `json:"name"`
|
|
KeyHash string `json:"key_hash"`
|
|
KeyPrefix string `json:"key_prefix"`
|
|
CreatedBy string `json:"created_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
LastUsed pgtype.Timestamptz `json:"last_used"`
|
|
}
|
|
|
|
type Template struct {
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Vcpus pgtype.Int4 `json:"vcpus"`
|
|
MemoryMb pgtype.Int4 `json:"memory_mb"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
TeamID string `json:"team_id"`
|
|
}
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Email string `json:"email"`
|
|
PasswordHash pgtype.Text `json:"password_hash"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
IsAdmin bool `json:"is_admin"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type UsersTeam struct {
|
|
UserID string `json:"user_id"`
|
|
TeamID string `json:"team_id"`
|
|
IsDefault bool `json:"is_default"`
|
|
Role string `json:"role"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|