Skip to main content

DataSourceVTable

Struct DataSourceVTable 

Source
#[repr(C)]
pub struct DataSourceVTable { pub init: Option<unsafe extern "C" fn(*const u8, usize) -> *mut c_void>, pub get_query_schema: Option<unsafe extern "C" fn(*mut c_void) -> *const QuerySchema>, pub get_output_schema: Option<unsafe extern "C" fn(*mut c_void) -> *const OutputSchema>, pub get_source_schema: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut u8, *mut usize) -> i32>, pub validate_query: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut i8) -> i32>, pub load: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut u8, *mut usize) -> i32>, pub load_binary: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, u8, Option<unsafe extern "C" fn(u8, u64, u64, u64, *mut c_void) -> i32>, *mut c_void, *mut *mut u8, *mut usize) -> i32>, pub subscribe: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, unsafe extern "C" fn(*const u8, usize, *mut c_void), *mut c_void) -> u64>, pub unsubscribe: Option<unsafe extern "C" fn(*mut c_void, u64) -> i32>, pub free_buffer: Option<unsafe extern "C" fn(*mut u8, usize)>, pub free_string: Option<unsafe extern "C" fn(*mut i8)>, pub drop: Option<unsafe extern "C" fn(*mut c_void)>, }
Expand description

Function pointer types for data source plugins

Fields§

§init: Option<unsafe extern "C" fn(*const u8, usize) -> *mut c_void>

Initialize the data source with configuration. config: MessagePack-encoded configuration object Returns: opaque instance pointer, or null on error

§get_query_schema: Option<unsafe extern "C" fn(*mut c_void) -> *const QuerySchema>

Get the query schema for this data source. Returns a pointer to the QuerySchema struct (must remain valid for plugin lifetime).

§get_output_schema: Option<unsafe extern "C" fn(*mut c_void) -> *const OutputSchema>

Get the output schema for this data source. Returns a pointer to the OutputSchema struct (must remain valid for plugin lifetime).

§get_source_schema: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut u8, *mut usize) -> i32>

Query the data schema for a specific source.

Unlike get_output_schema which returns a static schema for the plugin, this function returns the dynamic schema for a specific data source. This enables schema discovery at runtime.

source_id: The source identifier (e.g., table name, symbol, device ID) out_ptr: Output pointer to MessagePack-encoded PluginSchema out_len: Output length of the data

The returned PluginSchema (MessagePack) has structure:

{
  "columns": [
    { "name": "timestamp", "data_type": "Timestamp" },
    { "name": "value", "data_type": "Number" }
  ],
  "timestamp_column": "timestamp"
}

Returns: 0 on success, non-zero error code on failure Caller must free the output buffer with free_buffer.

§validate_query: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut i8) -> i32>

Validate a query before execution. query: MessagePack-encoded query parameters out_error: On error, write error message pointer here (caller must free with free_string) Returns: 0 on success, non-zero error code on failure

§load: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, *mut *mut u8, *mut usize) -> i32>

Load historical data (JSON/MessagePack format - legacy). query: MessagePack-encoded query parameters out_ptr: Output pointer to MessagePack-encoded Series data out_len: Output length of the data Returns: 0 on success, non-zero error code on failure Caller must free the output buffer with free_buffer.

§load_binary: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, u8, Option<unsafe extern "C" fn(u8, u64, u64, u64, *mut c_void) -> i32>, *mut c_void, *mut *mut u8, *mut usize) -> i32>

Load historical data in binary columnar format (ABI v2).

High-performance data loading that bypasses JSON serialization. Returns binary data in the format defined by binary_format module that can be directly mapped to SeriesStorage.

§Arguments

  • instance: Plugin instance
  • query: MessagePack-encoded query parameters
  • query_len: Length of query data
  • granularity: Progress reporting granularity (0=Coarse, 1=Fine)
  • progress_callback: Optional callback for progress reporting
  • progress_user_data: User data passed to progress callback
  • out_ptr: Output pointer to binary columnar data
  • out_len: Output length of the data

Returns: 0 on success, non-zero error code on failure Caller must free the output buffer with free_buffer.

§subscribe: Option<unsafe extern "C" fn(*mut c_void, *const u8, usize, unsafe extern "C" fn(*const u8, usize, *mut c_void), *mut c_void) -> u64>

Subscribe to streaming data. query: MessagePack-encoded query parameters callback: Called for each data point (data_ptr, data_len, user_data) callback_data: User data passed to callback Returns: subscription ID on success, 0 on failure

§unsubscribe: Option<unsafe extern "C" fn(*mut c_void, u64) -> i32>

Unsubscribe from streaming data. subscription_id: ID returned by subscribe Returns: 0 on success, non-zero on failure

§free_buffer: Option<unsafe extern "C" fn(*mut u8, usize)>

Free a buffer allocated by load.

§free_string: Option<unsafe extern "C" fn(*mut i8)>

Free an error string allocated by validate_query.

§drop: Option<unsafe extern "C" fn(*mut c_void)>

Cleanup and destroy the instance.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,