Skip to main content

Crate fusillade

Crate fusillade 

Source
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 tracing event, from one site. Severity is a literal tier token: Critical (error! + pages), Error (error!, no page), Warning (warn!, no page). reason must be a &'static str literal; trailing tokens are forwarded to tracing as fields and message.

Structs§

Batch
A batch represents one execution of all of a file’s templates.
BatchErrorDetails
Error details for a batch error item.
BatchErrorItem
Batch error item - represents a failed request in OpenAI format.
BatchId
Unique identifier for a batch.
BatchInput
Input parameters for creating a new batch.
BatchNotification
A batch with extra context for notification emails (file metadata, model names). Returned by poll_completed_batches which joins the files and requests tables.
BatchOutputItem
Batch output item - represents a completed request in OpenAI format.
BatchResponseDetails
Response details for a batch output item.
BatchResultItem
Merged batch result item combining input, output, and status. Used for the Results view to show input/output pairs in a single row.
BatchStatus
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.
CreateFlexInput
Input for creating a flex (async) response that the daemon will process.
CreateRealtimeInput
Input for creating a realtime response that the proxy is already handling.
CreateStepInput
Input to ResponseStepStore::create_step.
DaemonId
Unique identifier for a daemon.
Failed
Request failed after exhausting retries.
File
A file containing a collection of request templates.
FileFilter
Filter parameters for listing files
FileId
Unique identifier for a file.
FileMetadata
Metadata for creating a file from a stream
HttpResponse
Response from an upstream request execution.
LeakStamp
Leaky-bucket stamp for a request claimed via Source B (the not-live, before-ramp trickle). Carried on Claimed as Some iff the row was leaked; the daemon stamps next_token_at = now + window_secs / leaks_per_window for the (created_by, window_class, model) bucket. None for 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.
ListBatchesFilter
Filter parameters for listing batches
ListRequestsFilter
Filter parameters for listing requests across batches.
ModelFilter
A single model_filters event describing a model’s internal-liveness transition.
ModelTemplateStats
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.
PersistCompletedRealtimeInput
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.
RequestData
User-supplied data for a request to be processed by the fusillade system.
RequestDetail
Full detail of an individual request, including body and response.
RequestId
Unique identifier for a request in the system.
RequestListResult
Result of a paginated request list query.
RequestSummary
Summary of an individual request, suitable for list views.
RequestSummaryWithCountDeprecated
RequestTemplate
A request template defining how to make a request.
RequestTemplateInput
Input for creating a new request template.
ResponseStep
A row from the response_steps table.
StepId
Identifier of a single response step.
TemplateId
Unique identifier for a request template.

Enums§

AnyRequest
Enum that can hold a request in any state.
BatchResultStatus
Status of a batch result item.
CancellationReason
Reason for cancelling a request.
CascadeTargetState
Target state for cascading a batch’s terminal state to its in-flight requests.
FailureReason
Reason why a request failed.
FileContentItem
Enum for different types of file content that can be streamed.
FileStatus
File status tracking lifecycle and health.
FileStreamItem
Items that can be yielded from a file upload stream
FileStreamResult
Result of creating a file from a stream.
FusilladeError
Main error type for the batching system.
ModelFilterState
Liveness state of a model on internal (self-hosted) infrastructure, as published by the controller into the model_filters append-only event log.
OutputFileType
Type of batch output file for lookup purposes.
Purpose
Purpose for which a file was created.
RequestCompletionResult
Result of completing a processing request.
RequestStateFilter
Database state for filtering and querying requests.
ServiceTierFilter
Filter on service_tier.
StepKind
Discrete kinds of work a response step can represent.
StepState
Lifecycle state of a step.

Traits§

DaemonStorage
Daemon lifecycle persistence.
RequestState
Marker trait for valid request states.
ResponseStepStore
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.