Skip to main content

Module lifecycle_embed

Module lifecycle_embed 

Source
Expand description

Embed connection lifecycle — Phase 6B-7 part 4.

Per ADR 0017, embeddings live on a separate socket from v1 and v2. This module mirrors lifecycle_v2.rs but for the embed wire types (inferd_proto::embed::EmbedRequest / EmbedResponse).

Single-frame request / single-frame response — embeddings are not streamed (the result is a complete vector, there is nothing to stream). The connection stays open for the next request.

Per request:

  1. Read one NDJSON frame, parse as EmbedRequest.
  2. EmbedRequest::resolve() — structural validation.
  3. Admission gate (same Admission shared with v1 / v2; one slot is one slot regardless of wire surface).
  4. Dispatch through the router; check the chosen backend’s capabilities().embed flag — backends that don’t support embeddings yield Error{EmbedUnsupported, ...}.
  5. backend.embed(resolved) — errors map to embed error codes.
  6. Emit a single EmbedResponse::Embeddings or EmbedResponse::Error frame, then loop for the next request.

Re-exports§

pub use crate::lifecycle::AcceptContext;

Functions§

handle_embed_connection
Handle one accepted embed client connection.
serve_tcp_embed
Serve an embed TCP listener.
serve_uds_embed
Serve an embed Unix domain socket listener.