PsiACE commented on code in PR #6618:
URL: https://github.com/apache/opendal/pull/6618#discussion_r2542957074


##########
core/src/layers/concurrent_limit.rs:
##########
@@ -90,24 +90,61 @@ use crate::*;
 /// Ok(())
 /// # }
 /// ```
+/// ConcurrencySemaphore abstracts a semaphore-like concurrency primitive
+/// that yields an owned permit released on drop. It mirrors RetryLayer's
+/// interceptor pattern by serving as a generic extension point for the layer.
+pub trait ConcurrencySemaphore: Send + Sync + Any + Clone + 'static {
+    /// The owned permit type associated with the semaphore. Dropping it
+    /// must release the permit back to the semaphore.
+    type Permit: Send + Sync + 'static;
+
+    /// Acquire an owned permit asynchronously.
+    fn acquire_owned(&self) -> BoxFuture<'static, Self::Permit>;

Review Comment:
   Switched the trait to a single `acquire` method that returns `impl Future + 
MaybeSend`. Implementations still use `async fn acquire(&self)`, but the trait 
now enforces the `Send` requirement our layer methods need.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to