Expand description
Database row models and API request/response types for the kernel.
The models are partitioned into domain submodules for readability and then
re-exported flat, so every existing crate::models::Foo path keeps
resolving unchanged.
Structs§
- AiIngest
- Payload an AI worker POSTs to ingest detections (and optionally an event) for a camera.
- AiTask
- A perception task to run on a camera (consumed by AI workers).
- AiTask
Create - AiTask
Update - ApiKey
- ApiKey
Create - ApiKey
View - Archive
Export Request - Request body for POST /api/v1/archive/export — zip a selection of recorded footage on demand.
- Backup
Destination - A backup transfer target.
configis a kind-specific JSON blob (credentials live here and are never serialized raw — useBackupDestinationView). NotSerializefor exactly that reason. - Backup
Destination Create - Backup
Destination Update - Backup
Destination View - Client-facing destination: secret config values are replaced with
***. - Backup
Job - A single backup run (policy-scheduled, manually triggered, or an on-demand archive export).
- Backup
Policy - A scheduled backup policy: ship a camera selection’s recent footage to a destination on an interval.
- Backup
Policy Create - Backup
Policy Update - Backup
Test Result - Result of POST /api/v1/backup/destinations/{id}/test (a connectivity / writability probe).
- Camera
- Camera row as stored.
passwordis never serialized to clients; useCameraViewfor output. - Camera
Create - Payload to create a camera.
idmay be omitted (slug auto-derived from name). - Camera
Isapi - Per-camera HikVision ISAPI configuration state, populated by the camera-config service. Mirrors
GET /ISAPI/System/deviceInfo(identity),/System/Network/Integrate(onvif_enabled), the kernel-provisioned ONVIF user (onvif_user_created), and/System/time(time_mode/ntp_server). - Camera
Onvif - Per-camera ONVIF device profile, populated by
crate::services::onvif::probe.scopesis a JSON array of ONVIF scope URIs.ptz_enabledis true when the device exposes a PTZ service and the chosen media profile carries a PTZConfiguration. - Camera
Status - Camera
Update - Partial update; only present fields are changed.
- Camera
View - Client-facing camera representation: credentials stripped, stream URLs masked.
- Detection
- A detection result posted by an AI worker.
- Detection
Ingest - One detection inside an ingest request.
- Event
- Ingest
Event - Optional event an AI worker can raise alongside its detections.
- Login
Request - Persisted
Snapshot - A captured snapshot frame on disk (one file under snapshots_dir/{camera_id}/).
- PtzPreset
- A PTZ preset fetched from a camera’s ONVIF PTZ service (GetPresets). One row per (camera, token).
- Record
Schedule - A recurring per-camera recording window, applied when the camera’s
record_modeisscheduledorscheduled_event.daysis a JSON array of weekday ints (0=Mon..6=Sun);time_start/time_endare “HH:MM” 24h in the SERVER’s LOCAL timezone (chrono::Local). Whentime_start>time_endthe window wraps past midnight (its early-morning portion is attributed to the day it started on). - Record
Schedule Create - Record
Schedule Update - Recording
Gap - A recording gap detected by the indexer (a hole > 3s between consecutive segments). The ANR loop
(services/anr.rs) tries to re-fill pending gaps from the camera’s onboard storage.
fill_stateispending|filled|failed. - Segment
- Snapshot
Schedule - A per-camera schedule that captures a live JPEG every
interval_seconds. - Snapshot
Schedule Create - Snapshot
Schedule Update - User
- Operator account.
password_hashis never serialized; useUserViewfor output. - User
Create - User
Update - User
View - Webhook
Delivery - One webhook delivery attempt (the at-least-once retry ledger).
statusisdelivered|failed. - Webhook
Subscription - A webhook subscription row as stored.
secret(the HMAC signing key) is never serialized; useWebhookSubscriptionViewfor output.event_typesis a JSON array of type names; the sentinel["*"]matches every event type, otherwise it is an exact-membership set.cursor_atis the per-subscription delivery cursor (anevents.created_at); NULL means “start at now” (no backlog). - Webhook
Subscription Create - Webhook
Subscription Update - Partial update; an ABSENT field is left unchanged.
secretis three-state: omitted = unchanged, null = clear the secret, a value = set it (the outerOptiondistinguishes “field omitted” from an explicit null — see [de_field_present]). - Webhook
Subscription View - Client-facing subscription view: the
secretis replaced by ahas_secretflag and never echoed. - Zone
- A polygon region on a camera; tracked detections crossing it raise enter/exit/dwell events.
- Zone
Create - Zone
Event - Zone
Update
Constants§
- BACKUP_
SECRET_ KEYS - Config keys that hold a secret. Masked in
BackupDestinationView(and preserved across an update when the client round-trips the***placeholder back).
Functions§
- mask_
backup_ config - Mask the secret values in a config blob, returning the masked blob and whether any secret was set.
- mask_
webhook_ url - Mask a webhook URL for display: keep only
scheme://host[:port]and append/…so the path/token is never revealed. Returns None for an empty url; a url without a scheme is masked to…(it may be a bare token).