Skip to main content

PluginProcess

Struct PluginProcess 

Source
pub struct PluginProcess { /* private fields */ }

Implementations§

Source§

impl PluginProcess

Source

pub fn start(path: &Path, log: LogSink) -> Result<PluginProcess>

Spawn the plugin at path and complete the handshake.

Source

pub fn start_in( path: &Path, log: LogSink, cwd: Option<&Path>, ) -> Result<PluginProcess>

Like start, running the plugin in cwd (core uses the project directory).

Source

pub fn start_for( path: &Path, plugin: Option<&PluginId>, log: LogSink, cwd: Option<&Path>, ) -> Result<PluginProcess>

Like start_in, asking the executable for plugin (one of a package’s plugins).

Source

pub fn start_with( path: &Path, log: LogSink, versions: (u32, u32), timeout: Duration, ) -> Result<PluginProcess>

Spawn and handshake offering an explicit version range (the conformance suite uses this).

Source

pub fn spawn(path: &Path, log: LogSink) -> Result<PluginProcess>

Spawn without a handshake (for tests that probe raw protocol behaviour).

Source

pub fn spawn_env( path: &Path, log: LogSink, env: &[(&str, &str)], ) -> Result<PluginProcess>

Spawn with extra environment variables, without a handshake.

Source

pub fn spawn_in( path: &Path, log: LogSink, env: &[(&str, &str)], cwd: Option<&Path>, ) -> Result<PluginProcess>

Spawn with extra environment variables and a working directory, without a handshake.

Source

pub fn ask_for(&mut self, plugin: Option<PluginId>)

Name the plugin to ask for in the handshake (None: a package’s first).

Source

pub fn handshake( &mut self, (min, max): (u32, u32), timeout: Duration, ) -> Result<()>

Complete the handshake on a process from spawn/spawn_env.

Source

pub fn label(&self) -> &str

Source

pub fn path(&self) -> &Path

Source

pub fn info(&self) -> &PluginInfo

Source

pub fn has(&self, capability: &str) -> bool

Source

pub fn send(&mut self, req: &Request) -> Result<()>

Source

pub fn send_batch(&mut self, batch: &RecordBatch) -> Result<()>

Source

pub fn recv( &mut self, timeout: Option<Duration>, waiting_for: &'static str, ) -> Result<Incoming>

Receive the next message. timeout of None waits as long as the plugin is alive.

Source

pub fn recv_json(&mut self, waiting_for: &'static str) -> Result<Response>

Receive a JSON response, turning error into HostError::Plugin.

Source

pub fn describe(&mut self) -> Result<Vec<ConnectionField>>

Source

pub fn describe_all( &mut self, ) -> Result<(Vec<ConnectionField>, Vec<OptionField>)>

The connection fields and the options the plugin declares.

Source

pub fn validate(&mut self, options: Map<String, Value>) -> Result<Vec<String>>

Check a config block of options (needs validate); returns every problem found.

Source

pub fn open( &mut self, connection: Map<String, Value>, read_only: bool, ) -> Result<()>

Source

pub fn check(&mut self, sql: &str) -> Result<()>

Source

pub fn execute( &mut self, sql: &str, row_limit: Option<u64>, on_batch: impl FnMut(&SchemaRef, RecordBatch) -> Result<(), String>, ) -> Result<Execution>

Run one statement, handing every batch to on_batch as it arrives.

Source

pub fn write_begin( &mut self, path: &str, format: &str, options: Map<String, Value>, result_sets: Vec<ResultSetMeta>, template: Option<Value>, ) -> Result<()>

Start a format write; follow with write_result_set per result set, then write_finish.

Source

pub fn write_result_set( &mut self, schema: &SchemaRef, batches: impl IntoIterator<Item = RecordBatch>, ) -> Result<()>

Stream one result set: at least one batch (carrying the schema), then the end marker.

Source

pub fn load( &mut self, name: &str, schema: &SchemaRef, batches: impl IntoIterator<Item = RecordBatch>, ) -> Result<(String, Option<String>)>

Load rows into a temporary table on the source’s session. Returns the relation to use in SQL, and the plugin’s warning, if any. Only for plugins advertising load.

Source

pub fn write_finish(&mut self) -> Result<Vec<String>>

Source

pub fn write_finish_with_warnings( &mut self, ) -> Result<(Vec<String>, Vec<String>)>

write_finish, also returning the format’s warnings.

Source

pub fn deliver( &mut self, local_path: &str, remote_path: Option<&str>, connection: Map<String, Value>, ) -> Result<String>

Deliver one file with no plugin options.

Source

pub fn deliver_files( &mut self, files: &[DeliveryFile], connection: Map<String, Value>, options: Map<String, Value>, ) -> Result<String>

Deliver files in one request with the destination entry’s options. More than one file needs a plugin advertising multi_file; call once per file otherwise.

Source

pub fn close(self) -> Result<()>

Ask the plugin to exit, and wait for it.

Source

pub fn write_raw(&mut self, bytes: &[u8]) -> Result<()>

Raw access for protocol tests: write arbitrary bytes to the plugin.

Source

pub fn wait_exit(&mut self, timeout: Duration) -> Option<ExitStatus>

Wait up to timeout for the process to exit.

Trait Implementations§

Source§

impl Drop for PluginProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.