pub struct QueryBatcher { /* private fields */ }Expand description
Query batcher
Implementations§
Source§impl QueryBatcher
impl QueryBatcher
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new query batcher.
Note: without an executor wired in via QueryBatcher::with_executor,
every query execution fails loud. This prevents the batcher from
silently returning (and caching) fabricated placeholder results.
Sourcepub fn with_executor(self, executor: Arc<dyn BatchQueryExecutor>) -> Self
pub fn with_executor(self, executor: Arc<dyn BatchQueryExecutor>) -> Self
Attach the backend GraphQL executor used to run each batched query.
Sourcepub fn set_executor(&mut self, executor: Arc<dyn BatchQueryExecutor>)
pub fn set_executor(&mut self, executor: Arc<dyn BatchQueryExecutor>)
Set the backend GraphQL executor after construction.
Sourcepub async fn create_batch(&self) -> String
pub async fn create_batch(&self) -> String
Create a new batch
Sourcepub async fn add_query(
&self,
batch_id: &str,
query: BatchedQuery,
) -> Result<(), String>
pub async fn add_query( &self, batch_id: &str, query: BatchedQuery, ) -> Result<(), String>
Add query to batch
Sourcepub async fn execute_batch(&self, batch_id: &str) -> Result<BatchResult, String>
pub async fn execute_batch(&self, batch_id: &str) -> Result<BatchResult, String>
Execute batch
Sourcepub fn analyze_batch_dependencies(
queries: &[BatchedQuery],
) -> HashMap<String, Vec<String>>
pub fn analyze_batch_dependencies( queries: &[BatchedQuery], ) -> HashMap<String, Vec<String>>
Analyze batch dependencies: returns query_id -> list of query_ids it depends on
Sourcepub async fn get_statistics(&self, batch_id: &str) -> Option<BatchStatistics>
pub async fn get_statistics(&self, batch_id: &str) -> Option<BatchStatistics>
Get batch statistics
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear cache
Sourcepub async fn cache_size(&self) -> usize
pub async fn cache_size(&self) -> usize
Get cache size
Auto Trait Implementations§
impl !RefUnwindSafe for QueryBatcher
impl !UnwindSafe for QueryBatcher
impl Freeze for QueryBatcher
impl Send for QueryBatcher
impl Sync for QueryBatcher
impl Unpin for QueryBatcher
impl UnsafeUnpin for QueryBatcher
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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