spiral-sdk 0.1.7

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 uuid::Uuid;

use crate::api::tables::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait TablesApi: Send + Sync + 'static {
    /// Allocate a Table and its storage. Each successful request creates a new Table. Publish its
    /// initial version through the Catalog to install it in Project state.
    async fn create_table(
        &self,
        auth_header: AuthHeader,
        request: CreateTableRequest,
    ) -> Result<CreateTableResponse, CallError<TablesError>>;
    /// Record the caller-uploaded snapshot root identified by versionId, a UUIDv7. Multiple
    /// successors of one base are valid. Publish through the Catalog to make it visible.
    async fn create_version(
        &self,
        auth_header: AuthHeader,
        table_id: TableId,
        request: CreateVersionRequest,
    ) -> Result<CreateVersionResponse, CallError<TablesError>>;
    /// Read the storage root and ancestry of an exact immutable Table version.
    async fn read_version(
        &self,
        auth_header: AuthHeader,
        table_id: TableId,
        version_id: Uuid,
    ) -> Result<ReadVersionResponse, CallError<TablesError>>;
    /// Obtain short-lived access to the Table storage.
    async fn storage_access(
        &self,
        auth_header: AuthHeader,
        table_id: TableId,
        request: StorageAccessRequest,
    ) -> Result<StorageAccessResponse, CallError<TablesError>>;
    /// Obtain renewable typed storage access. A write scope limits a read-write binding to that
    /// part of a write.
    async fn storage_binding(
        &self,
        auth_header: AuthHeader,
        table_id: TableId,
        request: StorageAccessRequest,
    ) -> Result<StorageBinding, CallError<TablesError>>;
}