spiral-sdk 0.1.9

Rust SDK for Spiral resource and table APIs
Documentation
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]

use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;
use spiral_contract::stream::ByteStream;

use crate::api::sql::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait SqlApi: Send + Sync + 'static {
    /// Execute one query and stream its complete result. There is no implicit preview row limit;
    /// use SQL LIMIT when a bounded result is intended. The response starts with the Arrow schema,
    /// including for zero rows, followed by record batches as they become available. Consumption
    /// applies backpressure; clients can process batches without collecting the whole response.
    /// Only an explicit Arrow end-of-stream marker establishes success. Named errors use the
    /// standard contract envelope before output starts. After output starts, any failure terminates
    /// the response without that marker and the partial result must not be treated as complete.
    /// Closing the response cancels execution and releases admission and memory. Queries cannot be
    /// resumed; rerunning requires an explicit new request.
    async fn query(
        &self,
        auth_header: AuthHeader,
        request: Query,
    ) -> Result<ByteStream, CallError<SqlError>>;
}