Skip to main content

Module ffi

Module ffi 

Source
Expand description

C FFI layer for LaminarDB.

Enable with the ffi feature flag:

laminar-db = { version = "0.1", features = ["ffi"] }

This module provides extern "C" functions for calling LaminarDB from C and any language with C FFI support (Python, Java, Node.js, .NET, etc.). C FFI layer for LaminarDB.

Structs§

LaminarConnection
Opaque connection handle. Create with laminar_open, free with laminar_close.
LaminarQueryResult
Opaque handle for materialized query results.
LaminarQueryStream
Opaque handle for streaming query results.
LaminarRecordBatch
Opaque Arrow RecordBatch handle. Free with laminar_batch_free.
LaminarSchema
Opaque schema handle for FFI.
LaminarSubscriptionHandle
Opaque handle for a callback-based subscription.
LaminarWriter
Opaque writer handle for FFI.

Constants§

LAMINAR_ERR_CONNECTION
Connection error.
LAMINAR_ERR_INGESTION
Data ingestion error.
LAMINAR_ERR_INTERNAL
Internal error.
LAMINAR_ERR_INVALID_UTF8
Invalid UTF-8 string.
LAMINAR_ERR_NULL_POINTER
Null pointer was passed to a function.
LAMINAR_ERR_QUERY
Query execution error.
LAMINAR_ERR_SCHEMA_MISMATCH
Schema mismatch error.
LAMINAR_ERR_SHUTDOWN
Database is shutting down.
LAMINAR_ERR_SUBSCRIPTION
Subscription error.
LAMINAR_ERR_TABLE_EXISTS
Table/source already exists.
LAMINAR_ERR_TABLE_NOT_FOUND
Table/source not found.
LAMINAR_EVENT_DELETE
Event type: delete (-1 weight).
LAMINAR_EVENT_INSERT
Event type: insert (+1 weight).
LAMINAR_EVENT_SNAPSHOT
Event type: initial-state snapshot.
LAMINAR_EVENT_UPDATE
Event type: update (delete + insert pair).
LAMINAR_EVENT_WATERMARK
Event type: watermark progress.
LAMINAR_OK
Success return code.

Functions§

laminar_batch_create
Alias for laminar_batch_import for use when creating data for writing.
laminar_batch_export
Export a RecordBatch to the Arrow C Data Interface.
laminar_batch_export_column
Export a single column from a RecordBatch to the Arrow C Data Interface.
laminar_batch_free
Free a record batch handle.
laminar_batch_import
Import a RecordBatch from the Arrow C Data Interface, taking ownership of both structs.
laminar_batch_num_columns
Get the number of columns in a record batch.
laminar_batch_num_rows
Get the number of rows in a record batch.
laminar_clear_error
Clear the last error.
laminar_close
Close a database connection and free all associated resources.
laminar_execute
Execute a SQL statement. For DDL, out may be NULL.
laminar_get_schema
Get schema for a source.
laminar_is_closed
Check if the connection is closed.
laminar_last_error
Get the last error message as a null-terminated string, or null if no error.
laminar_last_error_code
Get the last error code, or LAMINAR_OK if none.
laminar_list_sources
List all sources as a JSON array (e.g., ["src1","src2"]). Caller frees with laminar_string_free.
laminar_open
Open a new database connection.
laminar_query
Execute a query and collect all results into memory.
laminar_query_stream
Execute a query with streaming results.
laminar_result_free
Free a query result handle.
laminar_result_get_batch
Get a batch by index from a query result.
laminar_result_num_batches
Get the number of batches in a query result.
laminar_result_num_rows
Get the total row count from a query result.
laminar_result_schema
Get the schema from a query result.
laminar_schema_export
Export just the schema to the Arrow C Data Interface.
laminar_schema_field_name
Get the name of a field by index. Caller frees the result with laminar_string_free.
laminar_schema_field_type
Get the Arrow data type of a field by index as a string. Caller frees with laminar_string_free.
laminar_schema_free
Free a schema handle.
laminar_schema_num_fields
Get the number of fields in a schema.
laminar_start
Start the streaming pipeline.
laminar_stream_cancel
Cancel a query stream.
laminar_stream_free
Free a query stream handle.
laminar_stream_is_active
Check if a query stream is still active.
laminar_stream_next
Get the next batch from a query stream (blocking). Sets *out to NULL when exhausted.
laminar_stream_schema
Get the schema from a query stream.
laminar_stream_try_next
Try to get the next batch from a query stream (non-blocking). Sets *out to NULL if none available.
laminar_string_free
Free a string allocated by a laminar function.
laminar_subscribe_callback
Create a callback-based subscription; on_data is called from a background thread.
laminar_subscription_cancel
Cancel a callback-based subscription; no callbacks will fire after this returns.
laminar_subscription_free
Free a subscription handle, cancelling it first if still active.
laminar_subscription_is_active
Check if a subscription is still active.
laminar_subscription_user_data
Return the user data pointer from a subscription handle, or NULL.
laminar_version
Return the library version as a static null-terminated string (do not free).
laminar_writer_close
Close the writer. The handle may still be freed with laminar_writer_free afterward.
laminar_writer_create
Create a writer for a source.
laminar_writer_flush
Flush buffered data.
laminar_writer_free
Free a writer handle.
laminar_writer_write
Write a record batch to the source. Ownership of batch is transferred.

Type Aliases§

LaminarErrorCallback
Callback invoked when a subscription error occurs.
LaminarSubscriptionCallback
Callback invoked from the subscription thread with each batch.