Rust

adapter

Module

Where a pool keeps its idle connections: Adapter, with Stack (last in, first out, never waits) and Channel (first in, first out, waits for a connection to come back).

Contents

use utopia_pools::Channel;
Rust
pub struct Channel<T>

Idle connections in a queue: the longest idle is reused first, and Adapter::pop waits for a connection to come back (or for capacity to be freed) up to its timeout. Wake-ups are coalesced to one pending signal, and a woken waiter that takes a connection passes the signal on while more remain.

Also implements Default.
use utopia_pools::Stack;
Rust
pub struct Stack<T>

Idle connections on a stack: the most recently returned is reused first, and Adapter::pop never waits.

Also implements Default.
use utopia_pools::Adapter;
Rust
pub trait Adapter<T>: Send + Sync + 'static

Storage and wake-ups for a pool's idle connections. The pool does the capacity accounting; an adapter only holds what is idle. Implement it to keep idle connections another way.

Implemented byStackChannel