Expand description
§blazingly-executor
Runtime-neutral operation executor for the Blazingly framework: extraction, validation, dependency resolution, and typed response projection.
This crate makes the operation model of blazingly-core executable.
ExecutableOperation pairs an OperationDescriptor with a handler; Plugin
scopes group operations with providers (from blazingly-di), lifecycle
hooks, and security schemes; ExecutableApp::from_plugin validates and
compiles the whole graph once, and invoke runs the full pipeline — hooks,
typed extraction, validation (behind the validation feature), the handler,
and projection into an ExecutionOutcome — for one operation. The same
pipeline serves HTTP requests (routed by blazingly-http) and MCP tool
calls. Extract<T> disambiguates a custom extractor from a compiled
dependency request, Extract<RequestParts> snapshots the HTTP request line,
and Plugin::mount / Plugin::with_id_namespace serve one module at two
prefixes under distinct operation identities.
The crate also owns the bounded blocking pool (run_blocking,
install_global_blocking_pool), which blazingly-database uses. It is opt-in,
not automatic: a synchronous handler runs inline on the calling thread and is
never moved to the pool, so work that genuinely blocks has to reach for
run_blocking itself.
Standalone use is real: there is no HTTP transport, no macro, and no async
runtime here. invoke returns an ordinary future you can drive with any
executor, which is how applications are tested in memory. The blazingly
facade adds the attribute macros that generate ExecutableOperations from
function signatures; without them, the typed, json, and empty
constructors build operations by hand, as below.
§Direct use
The example depends on blazingly-core and blazingly-json for the
descriptor and invocation value types, and uses futures-lite as the
executor; any executor works.
use blazingly_core::{HttpMethod, Json, OperationDescriptor, OperationId, ResponseDescriptor};
use blazingly_executor::{ExecutableApp, ExecutableOperation, ExecutionOutcome, Plugin};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let descriptor = OperationDescriptor::new(
HttpMethod::Get,
"/health",
"health.read",
"Liveness probe",
None,
vec![ResponseDescriptor::success(200, None)],
)?;
let app = ExecutableApp::from_plugin(
Plugin::new("app")
.operation(ExecutableOperation::empty(descriptor, || async { Json("ok") })),
)?;
let id = OperationId::new("health.read")?;
let outcome = futures_lite::future::block_on(app.invoke(&id, blazingly_json::Value::Null));
assert!(matches!(outcome, ExecutionOutcome::Success { status: 200, .. }));
Ok(())
}§Links
Macros§
- routes
- Collects annotated handlers into the operation list an application is built from.
Structs§
- Blocking
Future - Future resolved by a bounded blocking worker.
- Blocking
Pool - A bounded process-wide pool used only by explicitly synchronous handlers.
- Blocking
Pool Config - Capacity and worker count for synchronous blocking handlers.
- Cancellation
Token - Runtime-neutral cooperative cancellation shared by adapters and operation execution.
- Cancelled
- Future completed when a
CancellationTokenis cancelled. - Executable
App - A validated executable operation graph.
- Executable
Operation - A handler plus the operation descriptor shared by HTTP and MCP.
- Extension
- Typed request-local value installed by transport middleware.
- Extract
- Explicitly asks the operation macro to extract
Tfrom the invocation. - Hook
Context - Runtime-neutral metadata passed to compiled plugin hooks.
- Hook
Outcome - A body-free result summary passed to
on_responsehooks. - Input
Rejection - A stable client-visible failure produced while extracting an argument.
- Invocation
Control - Adapter-supplied cancellation and timeout signals for one invocation.
- Plugin
- A lexical provider scope containing operations and nested plugins.
- Request
Parts - An owned snapshot of the raw request parts, taken before the handler runs.
- Request
Provider - A provider together with the request inputs it declared.
- Resolved
Dependencies - Slot-based dependency values visible to one operation handler.
- Test
Overrides - Typed provider replacements applied only while compiling a test app.
- Upload
Body - Pull-based request body with adapter-enforced transport limits.
Enums§
- Blocking
Error - Failure to schedule or execute a synchronous blocking handler.
- Dependency
Error - A stable request rejection or an internal dependency failure.
- Executable
Build Error - An application-definition or dependency-compilation failure.
- Execution
Outcome - The protocol-neutral result of executing one operation.
- Hook
Outcome Kind - Stable result classes visible to plugin response hooks.
- Invocation
Abort - Reason a controlled invocation stopped before completion.
- Invocation
Input - Transport-neutral values supplied to typed operation extractors.
Traits§
- File
Payload - Types accepted by the typed
Fileextractor. - From
Invocation - Decodes one typed handler argument from an invocation.
- Http
Request Parts - Borrowed HTTP request values used by the compiled executor.
- Operation
Output - A typed handler result that can become a shared operation outcome.
Functions§
- blocking_
error_ outcome - install_
global_ blocking_ pool - Installs the process-wide blocking pool before the first sync invocation.
- on_
blocking_ worker - Reports whether the calling thread is a blocking-pool worker.
- run_
blocking - Schedules owned synchronous work without blocking an async worker.