openai_api_dispatch/queue/memory/mod.rs
1//! Shared in-process task/response queues; cloning shares the same storage.
2//!
3//! Both backends correlate responses by task ID, so IDs must be unique among
4//! outstanding tasks. With `std`, bounded Tokio channels wait for work and
5//! apply backpressure. Without `std`, spin-locked queues poll immediately and
6//! discard old entries when an optional capacity is reached.
7
8#[cfg(feature = "std")]
9/// Tokio-backed queue; defaults to a capacity of 100 for each channel.
10pub type MemoryQueue = use_std::MemoryQueueStd;
11
12#[cfg(not(feature = "std"))]
13/// Polling, spin-locked queue; unbounded unless a capacity is supplied.
14pub type MemoryQueue = nostd::MemoryQueueNoStd;
15
16mod nostd;
17#[cfg(feature = "std")]
18mod use_std;
19
20#[cfg(test)]
21mod tests;