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 = " 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 = " `PlanScan`: a `PlanScanRequest` envelope in, the scan plan's JSON out."]
pub fn scandal_plan_scan(
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 = " `ReadScan`: a `ReadScanRequest` envelope in, the split's rows out as a lazy Arrow stream\n whose last column holds each batch's next stored row. The output must be an empty stream;\n releasing it cancels the read."]
pub fn scandal_read_scan(
client: *const ScandalClient,
request_json: *const ::std::os::raw::c_char,
out: *mut ArrowArrayStream,
) -> *mut ScandalError;
}
unsafe extern "C" {
#[doc = " `TakeRows`: a `TakeRowsRequest` envelope in, the taken rows out in request order as a lazy\n Arrow stream whose last columns hold, as for `ReadScan`, each batch's progress: the request's\n positions delivered so far. The output must be an empty stream; releasing it cancels the read."]
pub fn scandal_take_rows(
client: *const ScandalClient,
request_json: *const ::std::os::raw::c_char,
out: *mut ArrowArrayStream,
) -> *mut ScandalError;
}
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 = " `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 = " `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;
}