Skip to main content

VTabLocalInit

Trait VTabLocalInit 

Source
pub trait VTabLocalInit: VTab {
    type LocalInitData: Send + Sync;

    // Required method
    fn local_init(init: &InitInfo<Self>) -> UdfResult<Self::LocalInitData>;
}
Expand description

A VTab that also produces per-worker-thread (“local”) init data, in addition to the query-wide init data every VTab already produces.

Registered via Connection::register_table_function_ext instead of Connection::register_table_function. Useful for state that must not be shared across threads (e.g. a non-Sync cursor or scratch buffer) when InitInfo::set_max_threads allows more than one worker.

Required Associated Types§

Source

type LocalInitData: Send + Sync

Data produced once per worker thread, retrievable on that same thread via TableFunctionInfo::local_init_data.

Required Methods§

Source

fn local_init(init: &InitInfo<Self>) -> UdfResult<Self::LocalInitData>

Produces this thread’s local init data.

§Errors

Returns an error to fail the query with that message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§