Module routes

Module routes 

Source
Expand description

HTTP handler functions for the stargazer operational API.

Each handler is an async fn that takes axum extractors (State, Query, Path) and returns either a JSON response or a StatusCode error. All database errors are logged at warn level and surfaced to the caller as 500 Internal Server Error with a generic body โ€” the raw sqlx::Error is never leaked because it may contain connection strings or schema details that are useful to an attacker.

ยงResponse types

The handlers operate on database rows (ReflectorRow, ActivityRow, StreamRow) but serialize trimmed *View structs over the wire. The view structs intentionally omit columns that are operationally useless to the HTTP consumer (raw audio_mp3 blobs, stream ids internal to the capture pipeline, etc.) and rename fields to the JSON conventions the operator dashboards expect.

ยงTime-window parsing

Query endpoints accept a since parameter of the form <n><unit> where n is a positive integer and unit is s, m, h, or d. The helper parse_since turns this into a DateTime<Utc> anchored at Utc::now(). A missing or unparseable value falls back to the endpoint-specific default (documented per handler).

Structsยง

ActivityQuery ๐Ÿ”’
Query parameters for the /api/reflectors/{callsign}/activity endpoint.
ActivityView ๐Ÿ”’
JSON view of one activity-log row.
ConnectedNodeView ๐Ÿ”’
JSON view of one connected-node row.
GlobalActivityQuery ๐Ÿ”’
Query parameters for the /api/activity endpoint.
HealthResponse ๐Ÿ”’
JSON response body for the /health endpoint.
MetricsResponse ๐Ÿ”’
JSON response body for the /metrics endpoint.
ReflectorQuery ๐Ÿ”’
Query parameters for the /api/reflectors endpoint.
ReflectorView ๐Ÿ”’
JSON view of one reflector row.
StreamQuery ๐Ÿ”’
Query parameters for the /api/streams endpoint.
StreamView ๐Ÿ”’
JSON view of one captured stream.
UploadQueueQuery ๐Ÿ”’
Query parameters for the /api/upload-queue endpoint.

Constantsยง

DEFAULT_ACTIVITY_LIMIT ๐Ÿ”’
Default row cap for /api/activity when limit is missing.
DEFAULT_ACTIVITY_WINDOW ๐Ÿ”’
Default time window for /api/reflectors/{callsign}/activity.
DEFAULT_REFLECTOR_WINDOW ๐Ÿ”’
Default time window for /api/reflectors when since is missing.
DEFAULT_STREAM_LIMIT ๐Ÿ”’
Default row cap for /api/streams when limit is missing.
DEFAULT_STREAM_WINDOW ๐Ÿ”’
Default time window for /api/streams.
DEFAULT_UPLOAD_LIMIT ๐Ÿ”’
Default row cap for /api/upload-queue when limit is missing.
MAX_LIMIT ๐Ÿ”’
Maximum rows any query endpoint will return regardless of limit.

Functionsยง

clamp_limit ๐Ÿ”’
Clamps a caller-provided row limit to the configured maximum.
health ๐Ÿ”’
GET /health โ€” kubernetes liveness/readiness probe.
list_activity ๐Ÿ”’
GET /api/activity โ€” global activity feed across all reflectors.
list_reflectors ๐Ÿ”’
GET /api/reflectors โ€” list active reflectors with status.
list_streams ๐Ÿ”’
GET /api/streams โ€” query captured streams with filters.
metrics ๐Ÿ”’
GET /metrics โ€” tier statistics snapshot.
parse_duration_string ๐Ÿ”’
Parses a relative time string like "1h" or "30m" into a Duration.
parse_since ๐Ÿ”’
Turns a relative since string into an absolute DateTime<Utc>.
reflector_activity ๐Ÿ”’
GET /api/reflectors/{callsign}/activity โ€” recent activity for one reflector.
reflector_nodes ๐Ÿ”’
GET /api/reflectors/{callsign}/nodes โ€” nodes linked to a reflector.
tier3_connect ๐Ÿ”’
POST /api/tier3/connect โ€” manually promote a reflector to Tier 3.
tier3_disconnect ๐Ÿ”’
DELETE /api/tier3/{callsign}/{module} โ€” disconnect a Tier 3 session.
upload_queue ๐Ÿ”’
GET /api/upload-queue โ€” pending and failed uploads.