<K>(self: PartitionedSemaphore<K>): numberGets the total capacity.
When to use
Use to inspect the fixed number of permits configured for the semaphore.
Details
Capacity is stored when the semaphore is created and does not change as permits are acquired or released.
export const const capacity: <K>(
self: PartitionedSemaphore<K>
) => number
Gets the total capacity.
When to use
Use to inspect the fixed number of permits configured for the semaphore.
Details
Capacity is stored when the semaphore is created and does not change as
permits are acquired or released.
capacity = <function (type parameter) K in <K>(self: PartitionedSemaphore<K>): numberK>(self: PartitionedSemaphore<K>(parameter) self: {
capacity: number;
available: Effect.Effect<number>;
take: (key: K, permits: number) => Effect.Effect<void>;
release: (permits: number) => Effect.Effect<number>;
withPermits: (key: K, permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: (key: K) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
}
self: interface PartitionedSemaphore<in K>A PartitionedSemaphore controls access to a shared permit pool while
tracking waiters by partition key.
When to use
Use to coordinate shared permits across partition keys so waiting groups make
progress without one group monopolizing the pool.
Details
Waiting permits are distributed across partitions in round-robin order.
PartitionedSemaphore<function (type parameter) K in <K>(self: PartitionedSemaphore<K>): numberK>): number => self: PartitionedSemaphore<K>(parameter) self: {
capacity: number;
available: Effect.Effect<number>;
take: (key: K, permits: number) => Effect.Effect<void>;
release: (permits: number) => Effect.Effect<number>;
withPermits: (key: K, permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermit: (key: K) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
withPermitsIfAvailable: (permits: number) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<Option.Option<A>, E, R>;
}
self.PartitionedSemaphore<in K>.capacity: numbercapacity