bge_m3_embedding_server/embedder/worker.rs
1// Copyright (c) 2026 J. Patrick Fulton
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Blocking worker thread, request dispatch, and probe wiring.
16//!
17//! Submodules:
18//! - `config`: per-worker execution policy (`WorkerConfig`).
19//! - `guard`: lifecycle guard, JIT guard wiring, inference outcomes.
20//! - `trt_retry`: TRT JIT-OOM detection and workspace-halving retry.
21//! - `propagation`: engine propagation broadcast drain.
22//! - `probe`: probe inference and arena priming helpers.
23//! - `prewarm_strict`: prewarm postcondition readiness gate.
24//! - `startup`: model load, cache GC, TRT prewarm, readiness signal.
25//! - `run`: request loop and idle lifecycle.
26//! - `dispatch`: per-request dense/sparse/dual/probe/adaptive-warmup handling.
27//! - `logging`: abandoned-request observability.
28
29mod config;
30mod dispatch;
31mod guard;
32mod logging;
33mod prewarm_strict;
34mod probe;
35mod propagation;
36mod run;
37mod startup;
38mod trt_retry;
39
40#[cfg(test)]
41mod tests;
42
43pub use config::WorkerConfig;
44pub(crate) use probe::probe_run_dense;
45pub(in crate::embedder) use run::run_worker;