pub struct LogsQueryManager { /* private fields */ }Expand description
Manages multiple in-flight log queries in parallel using promises.
Similar to QueryManager but for log queries. Tracks queries by unique ID,
enabling parallel log fetching for multiple time ranges or filters.
Includes timeout detection to prevent queries from hanging indefinitely.
§Example
let mut manager = LogsQueryManager::new();
// Fire multiple log queries in parallel
manager.execute(pane_id_1, &client, query1, &ctx);
manager.execute(pane_id_2, &client, query2, &ctx);
// In update loop, poll for all completed results
for (id, result) in manager.poll_all() {
// Handle result for pane with this id
}Implementations§
Source§impl LogsQueryManager
impl LogsQueryManager
Sourcepub fn with_timeout(timeout_secs: u64) -> Self
pub fn with_timeout(timeout_secs: u64) -> Self
Create a new logs query manager with a custom timeout.
Sourcepub fn is_querying(&self) -> bool
pub fn is_querying(&self) -> bool
Check if any queries are currently in flight.
Sourcepub fn is_querying_id(&self, id: usize) -> bool
pub fn is_querying_id(&self, id: usize) -> bool
Check if a specific query is in flight.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of queries currently in flight.
Sourcepub fn execute<C: LogsClient + ?Sized>(
&mut self,
id: usize,
client: &C,
query: LogsQuery,
ctx: &Context,
)
pub fn execute<C: LogsClient + ?Sized>( &mut self, id: usize, client: &C, query: LogsQuery, ctx: &Context, )
Execute a logs query for the given ID using the given client.
If a query for this ID is already in flight, it is cancelled and replaced.
Call poll_all() each frame to check for results.
Sourcepub fn poll_all(&mut self) -> Vec<(usize, LogsResult)>
pub fn poll_all(&mut self) -> Vec<(usize, LogsResult)>
Poll for all completed query results.
Returns a vector of (id, result) pairs for queries that completed or timed out.
Completed queries are removed from the pending set.
Sourcepub fn cancel(&mut self, id: usize)
pub fn cancel(&mut self, id: usize)
Cancel a specific query by ID.
Note: This doesn’t actually cancel the HTTP request, but it will ignore the result when it arrives.
Sourcepub fn cancel_all(&mut self)
pub fn cancel_all(&mut self)
Cancel all pending queries.