RoundRobinPool<T> class

A generic round-robin pool with per-slot future-chain serialization locks.

Items are selected in round-robin order. Concurrent callers on the same slot are serialized via a Future chain; callers on different slots can run in parallel.

Example:

final pool = RoundRobinPool([modelA, modelB, modelC]);
final result = await pool.withItem((model) async {
  return model.run(input);
});

Constructors

RoundRobinPool(List<T> items)

Properties

hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether the pool contains no items.
no setter
length → int
Number of items in the pool.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withItem<R>(Future<R> fn(T)) → Future<R>
Runs fn with exclusive access to one item, selected round-robin.

Operators

operator ==(Object other) → bool
The equality operator.
inherited