(permits: number): <K>(
self: PartitionedSemaphore<K>
) => Effect.Effect<number>
<K>(self: PartitionedSemaphore<K>, permits: number): Effect.Effect<number>Returns an effect that releases permits back to the shared pool and returns the current available permit count.
When to use
Use when you need to return permits acquired with take in a lower-level
partitioned permit protocol with explicit release control.
Details
Released permits are first assigned to waiting partitions in round-robin order. Only permits not needed by waiters increase the available count, which is capped at the semaphore capacity.
export const const release: {
(permits: number): <K>(
self: PartitionedSemaphore<K>
) => Effect.Effect<number>
<K>(
self: PartitionedSemaphore<K>,
permits: number
): Effect.Effect<number>
}
Returns an effect that releases permits back to the shared pool and returns
the current available permit count.
When to use
Use when you need to return permits acquired with take in a lower-level
partitioned permit protocol with explicit release control.
Details
Released permits are first assigned to waiting partitions in round-robin
order. Only permits not needed by waiters increase the available count,
which is capped at the semaphore capacity.
release: {
(permits: numberpermits: number): <function (type parameter) K in <K>(self: PartitionedSemaphore<K>): Effect.Effect<number>K>(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>): Effect.Effect<number>K>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<number>
<function (type parameter) K in <K>(self: PartitionedSemaphore<K>, permits: number): Effect.Effect<number>K>(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>, permits: number): Effect.Effect<number>K>, permits: numberpermits: number): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<number>
} = import dualdual(2, <function (type parameter) K in <K>(self: PartitionedSemaphore<K>, permits: number): Effect.Effect<number>K>(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>, permits: number): Effect.Effect<number>K>, permits: numberpermits: number): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<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<K>.release: (permits: number) => Effect.Effect<number>release(permits: numberpermits))