pub struct RequestQueue { /* private fields */ }Expand description
Manages pending requests and completed results for a mesh
Implementations§
Source§impl RequestQueue
impl RequestQueue
Sourcepub fn with_max_results(max_results: usize) -> Self
pub fn with_max_results(max_results: usize) -> Self
Create with a maximum result buffer size
Sourcepub fn submit(&self, target: &str, payload: String) -> String
pub fn submit(&self, target: &str, payload: String) -> String
Submit a new request, returns the request ID
Sourcepub fn complete(&self, request_id: &str, response: String)
pub fn complete(&self, request_id: &str, response: String)
Mark a request as completed with a response
Sourcepub fn get_pending(&self) -> Vec<MeshRequest>
pub fn get_pending(&self) -> Vec<MeshRequest>
Get all pending requests
Sourcepub fn get_stale(&self, older_than: Duration) -> Vec<MeshRequest>
pub fn get_stale(&self, older_than: Duration) -> Vec<MeshRequest>
Get pending requests older than the specified duration
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Check if there are any pending requests
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get number of pending requests
Sourcepub fn increment_reminder(&self, request_id: &str)
pub fn increment_reminder(&self, request_id: &str)
Increment reminder count for a request
Sourcepub fn take_results(&self) -> Vec<MeshResult>
pub fn take_results(&self) -> Vec<MeshResult>
Get available results (removes them from the queue)
Sourcepub fn peek_results(&self) -> Vec<MeshResult>
pub fn peek_results(&self) -> Vec<MeshResult>
Peek at results without removing them
Sourcepub fn take_result(&self, request_id: &str) -> Option<MeshResult>
pub fn take_result(&self, request_id: &str) -> Option<MeshResult>
Get result for a specific request (removes it if found)
Sourcepub async fn wait_next(&self, timeout: Duration) -> Option<MeshResult>
pub async fn wait_next(&self, timeout: Duration) -> Option<MeshResult>
Wait for the next result to become available
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RequestQueue
impl !RefUnwindSafe for RequestQueue
impl Send for RequestQueue
impl Sync for RequestQueue
impl Unpin for RequestQueue
impl UnwindSafe for RequestQueue
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
Mutably borrows from an owned value. Read more