spiral-sdk 0.1.11

Rust SDK for Spiral resource and table APIs
Documentation
/* automatically generated by rust-bindgen 0.73.2 */

use arrow_array::ffi::FFI_ArrowArray as ArrowArray;
use arrow_schema::ffi::FFI_ArrowSchema as ArrowSchema;
use async_ffi::FfiContext;
use arrow_array::ffi_stream::FFI_ArrowArrayStream as ArrowArrayStream;

#[doc = " Error owned by the native library."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalError {
    _unused: [u8; 0],
}
#[doc = " A `write_blob` in progress: the host writes parts, then finishes it for the blob."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalBlobUpload {
    _unused: [u8; 0],
}
#[doc = " The bytes of a `read_blob`, pulled one chunk at a time."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalByteStream {
    _unused: [u8; 0],
}
#[doc = " Embedded scandal and the runtime that executes its operations."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalClient {
    _unused: [u8; 0],
}
#[doc = " Host-owned encoded-page cache. Clients retain its budgets independently of this handle."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalReadCache {
    _unused: [u8; 0],
}
#[doc = " A host-polled scan. Poll its schema before its batches; release to cancel."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalScan {
    _unused: [u8; 0],
}
#[doc = " A scan plan polled by its host. Release after completion, failure or cancellation."]
#[repr(C)]
#[derive(Debug)]
pub struct ScandalScanPlan {
    _unused: [u8; 0],
}
#[doc = " Host callbacks for URI resolution. `resolve` writes an owned UTF-8 JSON result to `out`:\n The additional input is a JSON `ResourceAccess` (read, attempt or publication).\n `ResolvedUri` on true, or a contract error envelope on false. `free_result` releases it.\n `release` frees the context once all clients and streams have dropped their references."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ScandalUriResolver {
    pub context: *mut ::std::os::raw::c_void,
    pub resolve: ::std::option::Option<
        unsafe extern "C" fn(
            arg1: *mut ::std::os::raw::c_void,
            arg2: *const ::std::os::raw::c_char,
            arg3: *const ::std::os::raw::c_char,
            arg4: *mut *mut ::std::os::raw::c_char,
        ) -> bool,
    >,
    pub free_result: ::std::option::Option<
        unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void, arg2: *mut ::std::os::raw::c_char),
    >,
    pub release: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
}
#[doc = " Bytes borrowed from the library until the next call on their stream, or its release.\n An empty buffer ends the stream."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ScandalBuffer {
    pub data: *const u8,
    pub len: usize,
}
unsafe extern "C" {
    #[doc = " Create shared payload budgets from a JSON `ReadCacheOptions` value."]
    pub fn scandal_read_cache_create(
        options_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalReadCache,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Return the shared cache counters as JSON; the caller releases the result string."]
    pub fn scandal_read_cache_stats(
        cache: *const ScandalReadCache,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Release the host's cache handle. Existing clients and reads keep their cache alive."]
    pub fn scandal_read_cache_release(cache: *mut ScandalReadCache);
}
unsafe extern "C" {
    #[doc = " Read the error's message while the error remains alive."]
    pub fn scandal_error_message(error: *const ScandalError) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Read the error as the JSON error envelope HTTP returns, while the error remains alive."]
    pub fn scandal_error_json(error: *const ScandalError) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Release an owned error."]
    pub fn scandal_error_release(error: *mut ScandalError);
}
unsafe extern "C" {
    #[doc = " Release an owned JSON result."]
    pub fn scandal_string_release(value: *mut ::std::os::raw::c_char);
}
unsafe extern "C" {
    #[doc = " Whether the client has a host resolver for logical resource roots.\n The client must remain live throughout the call."]
    pub fn scandal_client_resolves_resources(client: *const ScandalClient) -> bool;
}
unsafe extern "C" {
    #[doc = " Create embedded scandal from its JSON configuration: the storage transports it may use."]
    pub fn scandal_client_create(
        config_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalClient,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Create scandal sharing an explicit host-owned payload cache. The cache handle must\n remain live during this call; the returned client retains its own cache reference."]
    pub fn scandal_client_create_with_read_cache(
        config_json: *const ::std::os::raw::c_char,
        cache: *const ScandalReadCache,
        out: *mut *mut ScandalClient,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Create scandal with host URI resolution and an optional shared read cache.\n Ownership of `resolver` transfers on entry, including when creation fails. Its callbacks\n must be thread-safe; streams retain them until their final read is released."]
    pub fn scandal_client_create_with_uri_resolver(
        config_json: *const ::std::os::raw::c_char,
        cache: *const ScandalReadCache,
        resolver: ScandalUriResolver,
        out: *mut *mut ScandalClient,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Release scandal. Streams and uploads it returned retain its runtime."]
    pub fn scandal_client_release(client: *mut ScandalClient);
}
unsafe extern "C" {
    #[doc = " `ListFunctions`: the SPQL function catalog as JSON."]
    pub fn scandal_list_functions(
        client: *const ScandalClient,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Start PlanScan without waiting. The returned handle retains the client state."]
    pub fn scandal_plan_scan(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalScanPlan,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Poll once with a borrowed async-ffi 0.5 FfiContext. A null output means Pending:\n its waker will be notified when progress is possible. Release the JSON result.\n Poll calls must be serialized. After completion or error, only release is allowed."]
    pub fn scandal_plan_scan_poll(
        plan: *mut ScandalScanPlan,
        context: *mut FfiContext,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Cancel and release a scan plan. Must not race with a poll."]
    pub fn scandal_plan_scan_release(plan: *mut ScandalScanPlan);
}
unsafe extern "C" {
    #[doc = " Start ReadScan without waiting. Schema and batch polls retain its runtime."]
    pub fn scandal_read_scan(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalScan,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Start TakeRows without waiting, using the same poll protocol as ReadScan."]
    pub fn scandal_take_rows(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalScan,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Poll scan opening once using a borrowed async-ffi context. Set ready to false on\n Pending and notify its waker when progress is possible. On Ready, fill an empty\n ArrowSchema with the rows and progress schema. Release the schema independently.\n Serialize all polls; after any error, only release is allowed."]
    pub fn scandal_scan_poll_schema(
        scan: *mut ScandalScan,
        context: *mut FfiContext,
        ready: *mut bool,
        out: *mut ArrowSchema,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Poll one batch after the schema is ready. Pending sets ready to false and registers\n the context's waker. Ready sets it to true: a released ArrowArray means EOF, otherwise\n ownership of the batch (including progress columns) transfers to the caller.\n Output must be empty. Serialize polls; after EOF or error, only release is allowed."]
    pub fn scandal_scan_poll_next(
        scan: *mut ScandalScan,
        context: *mut FfiContext,
        ready: *mut bool,
        out: *mut ArrowArray,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Cancel and release a scan, including any pending opening or batch read.\n Must not race with a poll. Already exported arrays remain owned by the host."]
    pub fn scandal_scan_release(scan: *mut ScandalScan);
}
unsafe extern "C" {
    #[doc = " Read resolved legacy rows as bounded Arrow IPC bytes. Releasing the stream releases its runtime."]
    pub fn scandal_read_legacy_table(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalByteStream,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `ReadBlob`: a `ReadBlobRequest` envelope in, a byte stream out."]
    pub fn scandal_read_blob(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalByteStream,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Read the next chunk of a blob into `out`; an empty buffer ends the stream. The bytes stay\n valid until the next call on this stream or its release."]
    pub fn scandal_byte_stream_next(
        stream: *mut ScandalByteStream,
        out: *mut ScandalBuffer,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Release a blob's byte stream, cancelling an unfinished read."]
    pub fn scandal_byte_stream_release(stream: *mut ScandalByteStream);
}
unsafe extern "C" {
    #[doc = " `StatBlob`: a `StatBlobRequest` envelope in, the blob's stored size and version out."]
    pub fn scandal_stat_blob(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `WriteBlob`: start an upload from a `WriteBlobRequest` envelope. Write its parts in order,\n then finish it for the blob."]
    pub fn scandal_write_blob(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ScandalBlobUpload,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Write the next part of an upload. The bytes are copied during the call."]
    pub fn scandal_blob_upload_write(
        upload: *mut ScandalBlobUpload,
        data: *const u8,
        len: usize,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Finish an upload and return its blob's JSON. Release the upload afterwards."]
    pub fn scandal_blob_upload_finish(
        upload: *mut ScandalBlobUpload,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Release an upload. An unfinished upload is cancelled and stores no blob a row can reference."]
    pub fn scandal_blob_upload_release(upload: *mut ScandalBlobUpload);
}
unsafe extern "C" {
    #[doc = " `StartBlobUpload`: a `StartBlobUploadRequest` envelope in, the upload's JSON out."]
    pub fn scandal_start_blob_upload(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `UploadBlobPart`: an `UploadBlobPartRequest` envelope and the part's `len` bytes in, the\n part's JSON out. The bytes are copied during the call."]
    pub fn scandal_upload_blob_part(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        data: *const u8,
        len: usize,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `CompleteBlobUpload`: a `CompleteBlobUploadRequest` envelope in, the blob's JSON out."]
    pub fn scandal_complete_blob_upload(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `AbortBlobUpload`: discard the stored parts of the upload an `AbortBlobUploadRequest`\n envelope names."]
    pub fn scandal_abort_blob_upload(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `AppendRows`: an `AppendRowsRequest` envelope and the rows in, fragment receipts' JSON out.\n After the request is read, the input's ownership transfers and its release callback is\n cleared, including on failure."]
    pub fn scandal_append_rows(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `PatchRows`: a `PatchRowsRequest` envelope and the rows in, fragment receipts' JSON out.\n After the request is read, the input's ownership transfers and its release callback is\n cleared, including on failure."]
    pub fn scandal_patch_rows(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `DeleteRows`: a `DeleteRowsRequest` envelope and the row IDs in, fragment receipts' JSON\n out. After the request is read, the input's ownership transfers and its release callback\n is cleared, including on failure."]
    pub fn scandal_delete_rows(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `AttachColumns`: an `AttachColumnsRequest` envelope and the rows in, the attached columns'\n receipt JSON out. After the request is read, the input's ownership transfers and its release\n callback is cleared, including on failure."]
    pub fn scandal_attach_columns(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `WriteAligned`: a `WriteAlignedRequest` envelope and the rows in, the mirrored file's\n receipt JSON out. After the request is read, the input's ownership transfers and its release\n callback is cleared, including on failure."]
    pub fn scandal_write_aligned(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `PlanChanges`: a `PlanChangesRequest` envelope in, the change plan's JSON out."]
    pub fn scandal_plan_changes(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `PackBlobs`: a `PackBlobsRequest` envelope and the rows in, the rows with their inline blob\n payloads packed out as an Arrow stream. Input ownership transfers as in `append_rows`; the\n output starts once every pack is stored."]
    pub fn scandal_pack_blobs(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut ArrowArrayStream,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `FinalizeWrite`: a `FinalizeWriteRequest` envelope in, the prepared version's receipt out."]
    pub fn scandal_finalize_write(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `BindProjection`: a `BindProjectionRequest` envelope in, the output schema's JSON out."]
    pub fn scandal_bind_projection(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut *mut ::std::os::raw::c_char,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " Search one exact Vector Index and return its rows as a lazy Arrow stream.\n Release the output stream to cancel the search."]
    pub fn scandal_search_vectors(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        out: *mut ArrowArrayStream,
    ) -> *mut ScandalError;
}
unsafe extern "C" {
    #[doc = " `Evaluate`: an `EvaluateRequest` envelope and the input rows in, the outputs out as a lazy\n Arrow stream, row for row with the input. Input ownership transfers as in `append_rows`;\n releasing the output cancels the evaluation and releases the input."]
    pub fn scandal_evaluate(
        client: *const ScandalClient,
        request_json: *const ::std::os::raw::c_char,
        input: *mut ArrowArrayStream,
        out: *mut ArrowArrayStream,
    ) -> *mut ScandalError;
}