mstar.api_server.rust_frontend#
The Rust axum frontend in front of APIServer.
mstar-server (rust/server/) owns the HTTP surface — routes, OpenAI
translation, SSE/NDJSON streaming, uploads, CORS — and speaks a flattened
msgpack protocol over the Rust ZMQ transport to this bridge, which
drives the existing Python data plane (APIServer.submit_request /
iter_result_chunks / abort_request; preprocessing and the conductor
protocol are untouched):
- frontend -> bridge: {t:”submit”, rid, text, file_paths,
input_modalities, output_modalities, model_kwargs, streaming} | {t:”abort”, rid}
- bridge -> frontend: {t:”chunk”, rid, modality, data(bin), metadata}
{t:”err”, rid, msg} | {t:”done”, rid}
The submit shape is APIServer.submit_request’s signature verbatim — the
protocol was designed by flattening it. The bridge mesh lives in its own
socket dir (private to the frontend/bridge pair), so entity names never
collide with the conductor/worker mesh.
Opt-in: mstar-serve --rust-frontend replaces uvicorn.run with the
mstar-server binary + this loop. Everything else in the process
(preprocess worker, conductor spawn, tensor transport) is identical.
Module Attributes
Upper bound on one blocking receive, so |
Functions
|
Resolve the |
|
Classes
|
The serve loop between the Rust frontend and |
- mstar.api_server.rust_frontend.BRIDGE_RECV_WAIT_S = 0.05#
Upper bound on one blocking receive, so
stop()is noticed promptly and the loop stays responsive to shutdown. Not a latency knob: an arriving message ends the wait immediately.
- class mstar.api_server.rust_frontend.RustFrontendBridge(server, bridge_dir)[source]#
Bases:
objectThe serve loop between the Rust frontend and
APIServer.- Parameters:
bridge_dir (str)