pub struct PluginProcess { /* private fields */ }Implementations§
Source§impl PluginProcess
impl PluginProcess
Sourcepub fn start(path: &Path, log: LogSink) -> Result<PluginProcess>
pub fn start(path: &Path, log: LogSink) -> Result<PluginProcess>
Spawn the plugin at path and complete the handshake.
Sourcepub fn start_in(
path: &Path,
log: LogSink,
cwd: Option<&Path>,
) -> Result<PluginProcess>
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).
Sourcepub fn start_for(
path: &Path,
plugin: Option<&PluginId>,
log: LogSink,
cwd: Option<&Path>,
) -> Result<PluginProcess>
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).
Sourcepub fn start_with(
path: &Path,
log: LogSink,
versions: (u32, u32),
timeout: Duration,
) -> Result<PluginProcess>
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).
Sourcepub fn spawn(path: &Path, log: LogSink) -> Result<PluginProcess>
pub fn spawn(path: &Path, log: LogSink) -> Result<PluginProcess>
Spawn without a handshake (for tests that probe raw protocol behaviour).
Sourcepub fn spawn_env(
path: &Path,
log: LogSink,
env: &[(&str, &str)],
) -> Result<PluginProcess>
pub fn spawn_env( path: &Path, log: LogSink, env: &[(&str, &str)], ) -> Result<PluginProcess>
Spawn with extra environment variables, without a handshake.
Sourcepub fn spawn_in(
path: &Path,
log: LogSink,
env: &[(&str, &str)],
cwd: Option<&Path>,
) -> Result<PluginProcess>
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.
Sourcepub fn ask_for(&mut self, plugin: Option<PluginId>)
pub fn ask_for(&mut self, plugin: Option<PluginId>)
Name the plugin to ask for in the handshake (None: a package’s first).
Sourcepub fn handshake(
&mut self,
(min, max): (u32, u32),
timeout: Duration,
) -> Result<()>
pub fn handshake( &mut self, (min, max): (u32, u32), timeout: Duration, ) -> Result<()>
Complete the handshake on a process from spawn/spawn_env.
pub fn label(&self) -> &str
pub fn path(&self) -> &Path
pub fn info(&self) -> &PluginInfo
pub fn has(&self, capability: &str) -> bool
pub fn send(&mut self, req: &Request) -> Result<()>
pub fn send_batch(&mut self, batch: &RecordBatch) -> Result<()>
Sourcepub fn recv(
&mut self,
timeout: Option<Duration>,
waiting_for: &'static str,
) -> Result<Incoming>
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.
Sourcepub fn recv_json(&mut self, waiting_for: &'static str) -> Result<Response>
pub fn recv_json(&mut self, waiting_for: &'static str) -> Result<Response>
Receive a JSON response, turning error into HostError::Plugin.
pub fn describe(&mut self) -> Result<Vec<ConnectionField>>
Sourcepub fn describe_all(
&mut self,
) -> Result<(Vec<ConnectionField>, Vec<OptionField>)>
pub fn describe_all( &mut self, ) -> Result<(Vec<ConnectionField>, Vec<OptionField>)>
The connection fields and the options the plugin declares.
Sourcepub fn validate(&mut self, options: Map<String, Value>) -> Result<Vec<String>>
pub fn validate(&mut self, options: Map<String, Value>) -> Result<Vec<String>>
Check a config block of options (needs validate); returns every problem found.
pub fn open( &mut self, connection: Map<String, Value>, read_only: bool, ) -> Result<()>
pub fn check(&mut self, sql: &str) -> Result<()>
Sourcepub fn execute(
&mut self,
sql: &str,
row_limit: Option<u64>,
on_batch: impl FnMut(&SchemaRef, RecordBatch) -> Result<(), String>,
) -> Result<Execution>
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.
Sourcepub fn write_begin(
&mut self,
path: &str,
format: &str,
options: Map<String, Value>,
result_sets: Vec<ResultSetMeta>,
template: Option<Value>,
) -> Result<()>
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.
Sourcepub fn write_result_set(
&mut self,
schema: &SchemaRef,
batches: impl IntoIterator<Item = RecordBatch>,
) -> Result<()>
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.
Sourcepub fn load(
&mut self,
name: &str,
schema: &SchemaRef,
batches: impl IntoIterator<Item = RecordBatch>,
) -> Result<(String, Option<String>)>
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.
pub fn write_finish(&mut self) -> Result<Vec<String>>
Sourcepub fn write_finish_with_warnings(
&mut self,
) -> Result<(Vec<String>, Vec<String>)>
pub fn write_finish_with_warnings( &mut self, ) -> Result<(Vec<String>, Vec<String>)>
write_finish, also returning the format’s warnings.
Sourcepub fn deliver(
&mut self,
local_path: &str,
remote_path: Option<&str>,
connection: Map<String, Value>,
) -> Result<String>
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.
Sourcepub fn deliver_files(
&mut self,
files: &[DeliveryFile],
connection: Map<String, Value>,
options: Map<String, Value>,
) -> Result<String>
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.
Sourcepub fn write_raw(&mut self, bytes: &[u8]) -> Result<()>
pub fn write_raw(&mut self, bytes: &[u8]) -> Result<()>
Raw access for protocol tests: write arbitrary bytes to the plugin.
Sourcepub fn wait_exit(&mut self, timeout: Duration) -> Option<ExitStatus>
pub fn wait_exit(&mut self, timeout: Duration) -> Option<ExitStatus>
Wait up to timeout for the process to exit.