opendal icon indicating copy to clipboard operation
opendal copied to clipboard

new feature: `ConcurrentLimitLayer` should accept a `Semaphore`

Open bonsairobo opened this issue 3 months ago • 2 comments

Feature Description

Add a method to ConcurrentLimitLayer to provide an Arc<Semaphore>.

Problem and Solution

Some applications may have their own semaphores used for limiting concurrency. For example, when limiting a process's open file handles. ConcurrentLimitLayer is already using Arc<Semaphore> internally, so this only needs to be exposed.

Additional Context

No response

Are you willing to contribute to the development of this feature?

  • [x] Yes, I am willing to contribute to the development of this feature.

bonsairobo avatar Sep 24 '25 06:09 bonsairobo

We designed this way because we didn’t want to depend on external APIs like Tokio’s Semaphore. But since we have no other choice, let’s just expose it.

Do you want to implement it?

Xuanwo avatar Sep 30 '25 17:09 Xuanwo

We designed this way because we didn’t want to depend on external APIs like Tokio’s Semaphore.

Yea it is kind of a shame that we have to choose one semaphore impl. As such, if users want a different semaphore type, they'll just need to implement their own layer.

Do you want to implement it?

Sure, though it might not be a high priority for me. If someone else has time to do it, they should preempt me.

bonsairobo avatar Sep 30 '25 18:09 bonsairobo