@rivus/agent-kit-collab/lanes
createLanes — Effect
Functions
createLanes()
function createLanes<E = never, R = never>(config: LanesConfig<E, R>): Effect<Lanes, LanesConfigInvalid, Scope | R>;Creates lanes in the caller's Scope. The lanes capture the context they are created in and give it to every
activation; fails with LanesConfigInvalid for a limit out of range.
Type Parameters
E
E = never
R
R = never
Parameters
config
LanesConfig<E, R>
Returns
Effect<Lanes, LanesConfigInvalid, Scope | R>
Interfaces
Lanes
Lanes created in a caller's Scope; closing that Scope runs close.
Properties
close
readonly close: Effect<void>;Refuses later wakes with LanesClosed, drops the queue and every pending wake, interrupts the running
activations and waits until they have ended. Idempotent.
status
readonly status: Effect<LanesStatus>;Methods
cancel()
cancel(key: string): Effect<void>;Drops the wakes key owes and interrupts its running activation, then waits until that activation, onExit
included, has ended. Wakes that arrive after the cancel are served as usual.
Parameters
key
string
Returns
Effect<void>
wake()
wake(key: string): Effect<WakeResult, LaneQueueFull | LanesClosed>;Asks for an activation of key without waiting for it. An idle lane starts when a slot is free and nobody waits
for one, otherwise it joins the end of the queue, or fails with LaneQueueFull when maxQueued lanes already
wait. A queued or running lane coalesces the wake: at most one more activation follows the running one.
Parameters
key
string
Returns
Effect<WakeResult, LaneQueueFull | LanesClosed>
Type Aliases
ActivationExit
type ActivationExit<E> =
| {
_tag: "ActivationSucceeded";
key: string;
}
| {
_tag: "ActivationFailed";
cause: Cause.Cause<E>;
key: string;
}
| {
_tag: "ActivationInterrupted";
key: string;
reason: ActivationInterruptReason;
};How an activation ended. An activation that succeeded or failed by itself is reported so even when a cancel, close
or timeout comes while its Scope closes; ActivationInterrupted means the lanes cut it short or it never started.
Type Parameters
E
E