pub struct PluginEngine { /* private fields */ }
Expand description
Manages a particular query session.
This struct invokes a Query
trait object, passing a handle to itself to Query::run()
. This
allows the query logic to request information from other Hipcheck plugins in order to complete.
Implementations§
Source§impl PluginEngine
impl PluginEngine
Sourcepub fn mock(mock_responses: MockResponses) -> Self
Available on crate feature mock_engine
only.
pub fn mock(mock_responses: MockResponses) -> Self
mock_engine
only.Constructor for use in unit tests, query()
function will reference this map instead of
trying to connect to Hipcheck core for a response value
Sourcepub fn batch<T>(&mut self, target: T) -> Result<QueryBuilder<'_>>
pub fn batch<T>(&mut self, target: T) -> Result<QueryBuilder<'_>>
Convenience function to expose a QueryBuilder
to make it convenient to dynamically build
up queries to plugins and send them off to the target
plugin, in as few GRPC calls as
possible
Sourcepub async fn query<T, V>(&mut self, target: T, input: V) -> Result<JsonValue>
pub async fn query<T, V>(&mut self, target: T, input: V) -> Result<JsonValue>
Query another Hipcheck plugin target
with key input
. On success, the JSONified result
of the query is returned. target
will often be a string of the format
"publisher/plugin[/query]"
, where the bracketed substring is optional if the plugin’s
default query endpoint is desired. input
must be of a type implementing serde::Serialize
,
Sourcepub async fn batch_query<T, V>(
&mut self,
target: T,
keys: Vec<V>,
) -> Result<Vec<JsonValue>>
pub async fn batch_query<T, V>( &mut self, target: T, keys: Vec<V>, ) -> Result<Vec<JsonValue>>
Query another Hipcheck plugin target
with Vec of inputs
. On success, the JSONified result
of the query is returned. target
will often be a string of the format
"publisher/plugin[/query]"
, where the bracketed substring is optional if the plugin’s
default query endpoint is desired. keys
must be a Vec containing a type which implements serde::Serialize
,
Sourcepub fn record_concern<S: AsRef<str>>(&mut self, concern: S)
pub fn record_concern<S: AsRef<str>>(&mut self, concern: S)
Records a string-like concern that will be emitted in the final Hipcheck report. Intended
for use within a Query
trait impl.
Sourcepub fn get_concerns(&self) -> &[String]
Available on crate feature mock_engine
only.
pub fn get_concerns(&self) -> &[String]
mock_engine
only.Exposes the current set of concerns recorded by PluginEngine
Trait Implementations§
Source§impl Drop for PluginEngine
impl Drop for PluginEngine
Source§impl From<MockResponses> for PluginEngine
Available on crate feature mock_engine
only.
impl From<MockResponses> for PluginEngine
mock_engine
only.Source§fn from(value: MockResponses) -> Self
fn from(value: MockResponses) -> Self
Auto Trait Implementations§
impl Freeze for PluginEngine
impl !RefUnwindSafe for PluginEngine
impl Send for PluginEngine
impl Sync for PluginEngine
impl Unpin for PluginEngine
impl !UnwindSafe for PluginEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request