Expand description
Batching system for HTTP requests with retry logic and concurrency control.
This crate provides ‘managers’ that accept submitted HTTP requests, and provides an API for checking their status over time. Behind the scenes, a daemon processes these requests in batches, retrying failed requests with exponential backoff and enforcing concurrency limits
Batching system with PostgreSQL storage and background daemon for processing requests.
Re-exports§
pub use daemon::Daemon;pub use daemon::DaemonConfig;pub use daemon::DaemonMode;pub use daemon::ModelEscalationConfig;pub use http::HttpClient;pub use http::MockHttpClient;pub use http::ReqwestHttpClient;pub use http::StreamEvent;pub use http::StreamEventCallback;pub use http::StreamReassembler;pub use manager::DaemonExecutor;pub use manager::PostgresDaemon;pub use processor::CancellationFuture;pub use processor::DefaultRequestProcessor;pub use processor::RequestProcessor;pub use processor::ShouldRetry;pub use transform::ResponseTransformer;
Modules§
- batch
- File and batch types for grouping requests.
- bg_
errors - Unified background-error metric and log for the fusillade daemon.
- daemon
- Daemon for processing batched requests with per-model concurrency control.
- error
- Error types for the batching system.
- http
- HTTP client abstraction for making requests.
- manager
- Daemon runtime traits.
- processor
- Per-row processing hook for the daemon.
- query
- Cross-batch request query types and filters.
- request
- Request aggregate - domain model and state transitions.
- response_
step - Response step storage primitives for multi-step Open Responses orchestration.
- transform
- TRANSITIONAL ZDR hook: transform a response/error body just before it is persisted.
- transitions
- State transitions for batch requests using the typestate pattern.
- types
- Core types for the batching system.
Macros§
- background_
error - Record a daemon background failure: increment the metric AND emit a
tracingevent, from one site. Severity is a literal tier token:Critical(error! + pages),Error(error!, no page),Warning(warn!, no page).reasonmust be a&'static strliteral; trailing tokens are forwarded totracingas fields and message.
Structs§
- Batch
- A batch represents one execution of all of a file’s templates.
- Batch
Error Details - Error details for a batch error item.
- Batch
Error Item - Batch error item - represents a failed request in OpenAI format.
- BatchId
- Unique identifier for a batch.
- Batch
Input - Input parameters for creating a new batch.
- Batch
Notification - A batch with extra context for notification emails (file metadata, model names).
Returned by
poll_completed_batcheswhich joins the files and requests tables. - Batch
Output Item - Batch output item - represents a completed request in OpenAI format.
- Batch
Response Details - Response details for a batch output item.
- Batch
Result Item - Merged batch result item combining input, output, and status. Used for the Results view to show input/output pairs in a single row.
- Batch
Status - Status information for a batch, computed from its executions.
- Canceled
- Request was canceled by the caller.
- Claimed
- Request has been claimed by a daemon but not yet actively executing.
- Completed
- Request completed successfully.
- Create
Flex Input - Input for creating a flex (async) response that the daemon will process.
- Create
Realtime Input - Input for creating a realtime response that the proxy is already handling.
- Create
Step Input - Input to
ResponseStepStore::create_step. - Daemon
Id - Unique identifier for a daemon.
- Failed
- Request failed after exhausting retries.
- File
- A file containing a collection of request templates.
- File
Filter - Filter parameters for listing files
- FileId
- Unique identifier for a file.
- File
Metadata - Metadata for creating a file from a stream
- Http
Response - Response from an upstream request execution.
- Leak
Stamp - Leaky-bucket stamp for a request claimed via Source B (the not-live,
before-ramp trickle). Carried on
ClaimedasSomeiff the row was leaked; the daemon stampsnext_token_at = now + window_secs / leaks_per_windowfor the(created_by, window_class, model)bucket.Nonefor full-capacity (Source A) claims, which consume no token. The model is read from the request itself, so it is not carried on the stamp. - List
Batches Filter - Filter parameters for listing batches
- List
Requests Filter - Filter parameters for listing requests across batches.
- Model
Filter - A single
model_filtersevent describing a model’s internal-liveness transition. - Model
Template Stats - Aggregated statistics for a model’s templates in a file. Used for efficient cost estimation without streaming all template data.
- Pending
- Request is waiting to be processed.
- Persist
Completed Realtime Input - Input for persisting a batch of already-completed realtime responses.
- Processing
- Request is currently being processed by a daemon (i.e., HTTP request in flight).
- Request
- A request to be processed by the fusillade system.
- Request
Data - User-supplied data for a request to be processed by the fusillade system.
- Request
Detail - Full detail of an individual request, including body and response.
- Request
Id - Unique identifier for a request in the system.
- Request
List Result - Result of a paginated request list query.
- Request
Summary - Summary of an individual request, suitable for list views.
- Request
Summary With Count Deprecated - Request
Template - A request template defining how to make a request.
- Request
Template Input - Input for creating a new request template.
- Response
Step - A row from the
response_stepstable. - StepId
- Identifier of a single response step.
- Template
Id - Unique identifier for a request template.
Enums§
- AnyRequest
- Enum that can hold a request in any state.
- Batch
Result Status - Status of a batch result item.
- Cancellation
Reason - Reason for cancelling a request.
- Cascade
Target State - Target state for cascading a batch’s terminal state to its in-flight requests.
- Failure
Reason - Reason why a request failed.
- File
Content Item - Enum for different types of file content that can be streamed.
- File
Status - File status tracking lifecycle and health.
- File
Stream Item - Items that can be yielded from a file upload stream
- File
Stream Result - Result of creating a file from a stream.
- Fusillade
Error - Main error type for the batching system.
- Model
Filter State - Liveness state of a model on internal (self-hosted) infrastructure, as
published by the controller into the
model_filtersappend-only event log. - Output
File Type - Type of batch output file for lookup purposes.
- Purpose
- Purpose for which a file was created.
- Request
Completion Result - Result of completing a processing request.
- Request
State Filter - Database state for filtering and querying requests.
- Service
Tier Filter - Filter on
service_tier. - Step
Kind - Discrete kinds of work a response step can represent.
- Step
State - Lifecycle state of a step.
Traits§
- Daemon
Storage - Daemon lifecycle persistence.
- Request
State - Marker trait for valid request states.
- Response
Step Store - Storage trait for response step persistence.
- Storage
- Storage trait for persisting and querying requests.
Type Aliases§
- Result
- Result type alias using the fusillade error type.