pub struct CancellationManager { /* private fields */ }Expand description
Request cancellation manager
Implementations§
Source§impl CancellationManager
impl CancellationManager
Sourcepub fn new() -> CancellationManager
pub fn new() -> CancellationManager
Create a new cancellation manager
Sourcepub async fn register_request(
&self,
id: Value,
method: String,
) -> Result<(), MCPError>
pub async fn register_request( &self, id: Value, method: String, ) -> Result<(), MCPError>
Register a new request for cancellation tracking
Sourcepub async fn cancel_request(
&self,
id: &Value,
reason: Option<String>,
) -> Result<bool, MCPError>
pub async fn cancel_request( &self, id: &Value, reason: Option<String>, ) -> Result<bool, MCPError>
Cancel a request
Sourcepub async fn is_cancelled(&self, id: &Value) -> bool
pub async fn is_cancelled(&self, id: &Value) -> bool
Check if a request has been cancelled
Sourcepub async fn complete_request(&self, id: &Value) -> Result<(), MCPError>
pub async fn complete_request(&self, id: &Value) -> Result<(), MCPError>
Remove a completed request
Sourcepub async fn active_requests(&self) -> Vec<CancellableRequest>
pub async fn active_requests(&self) -> Vec<CancellableRequest>
Get all active requests
Sourcepub async fn cleanup_old_requests(
&self,
max_age: Duration,
) -> Result<usize, MCPError>
pub async fn cleanup_old_requests( &self, max_age: Duration, ) -> Result<usize, MCPError>
Clean up old requests (older than max_age)
Sourcepub async fn handle_cancellation(
&self,
notification: CancelledNotification,
) -> Result<bool, MCPError>
pub async fn handle_cancellation( &self, notification: CancelledNotification, ) -> Result<bool, MCPError>
Handle a cancellation notification
Trait Implementations§
Source§impl Debug for CancellationManager
impl Debug for CancellationManager
Source§impl Default for CancellationManager
impl Default for CancellationManager
Source§fn default() -> CancellationManager
fn default() -> CancellationManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CancellationManager
impl !RefUnwindSafe for CancellationManager
impl Send for CancellationManager
impl Sync for CancellationManager
impl Unpin for CancellationManager
impl !UnwindSafe for CancellationManager
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