Xuanwo commented on code in PR #6618:
URL: https://github.com/apache/opendal/pull/6618#discussion_r2451257495
##########
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:
Maybe we can just use `async fn acquire_owned(&self)` here? And since we
don't have other APIs, is it a good idea to just use `acquire`?
##########
core/src/layers/concurrent_limit.rs:
##########
@@ -90,24 +90,61 @@ use crate::*;
/// Ok(())
/// # }
/// ```
+/// ConcurrencySemaphore abstracts a semaphore-like concurrency primitive
Review Comment:
Hi, please review your code before submitting.
--
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]