PartitionedSemaphore.ts overview
Since v3.19.4
Exports Grouped by Category
Constructors
make
A PartitionedSemaphore is a concurrency primitive that can be used to control concurrent access to a resource across multiple partitions identified by keys.
The total number of permits is shared across all partitions, with waiting permits equally distributed among partitions using a round-robin strategy.
This is useful when you want to limit the total number of concurrent accesses to a resource, while still allowing for fair distribution of access across different partitions.
Signature
declare const make: <K = unknown>(options: { readonly permits: number }) => Effect.Effect<PartitionedSemaphore<K>>
Since v3.19.4
makeUnsafe
A PartitionedSemaphore is a concurrency primitive that can be used to control concurrent access to a resource across multiple partitions identified by keys.
The total number of permits is shared across all partitions, with waiting permits equally distributed among partitions using a round-robin strategy.
This is useful when you want to limit the total number of concurrent accesses to a resource, while still allowing for fair distribution of access across different partitions.
Signature
declare const makeUnsafe: <K = unknown>(options: { readonly permits: number }) => PartitionedSemaphore<K>
Since v3.19.4
Models
PartitionedSemaphore (interface)
A PartitionedSemaphore is a concurrency primitive that can be used to control concurrent access to a resource across multiple partitions identified by keys.
The total number of permits is shared across all partitions, with waiting permits equally distributed among partitions using a round-robin strategy.
This is useful when you want to limit the total number of concurrent accesses to a resource, while still allowing for fair distribution of access across different partitions.
Signature
export interface PartitionedSemaphore<in K> {
readonly [TypeId]: TypeId
readonly withPermits: (key: K, permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
}
Since v3.19.4
TypeId
Signature
declare const TypeId: "~effect/PartitionedSemaphore"
Since v3.19.4
TypeId (type alias)
Signature
type TypeId = "~effect/PartitionedSemaphore"
Since v3.19.4