pub struct PersistCompletedRealtimeInput {
pub request_id: Uuid,
pub response_body: String,
pub status_code: u16,
pub request_body: String,
pub model: String,
pub endpoint: String,
pub method: String,
pub path: String,
pub api_key: String,
pub created_by: String,
pub started_at: DateTime<Utc>,
pub completed_at: DateTime<Utc>,
}Expand description
Input for persisting a batch of already-completed realtime responses.
Used by the dwctl responses writer to flush a buffer of finished realtime calls in one transaction.
Two cases are handled in the same batch:
- Background realtime: the row was pre-created in
processingstate bycreate_realtime; we UPDATE it tocompleted. - Non-background realtime: no row exists yet; we INSERT a template and
a request row directly in
completedstate.
All synthesize fields (request_body, model, endpoint, started_at,
completed_at, etc.) are only consulted on the INSERT path. On the UPDATE
path only request_id, response_body, and status_code are used — the
pre-existing row already carries a real started_at from create_realtime.
Fields§
§request_id: UuidThe request UUID (primary key).
response_body: StringUpstream response body to store.
status_code: u16Upstream HTTP status code.
request_body: StringOriginal request body, stored on the synthesized template.
model: StringModel identifier.
endpoint: StringBase URL of the target endpoint.
method: StringHTTP method (e.g., “POST”).
path: StringAPI path (e.g., “/v1/responses”).
api_key: StringAPI key for the request.
created_by: StringUser/org ID that owns this request.
started_at: DateTime<Utc>Wall-clock instant the request arrived, as recorded by the caller.
INSERT path only: becomes the synthesized row’s created_at,
claimed_at, and started_at. Ignored on the UPDATE path, where the row
already carries a real started_at.
completed_at: DateTime<Utc>Wall-clock instant the response completed (started_at plus the caller’s
measured request duration). INSERT path only: stored as the row’s completed_at on 2xx
(so the listing’s duration_ms = completed_at - started_at reflects the
true latency instead of zero) or as failed_at on non-2xx. Note
duration_ms is derived from the completed_at column, so it is NULL for
failed rows — the completion instant is still recorded there, in
failed_at. Ignored on the UPDATE path.
Trait Implementations§
Source§impl Clone for PersistCompletedRealtimeInput
impl Clone for PersistCompletedRealtimeInput
Source§fn clone(&self) -> PersistCompletedRealtimeInput
fn clone(&self) -> PersistCompletedRealtimeInput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more