Skip to main content

PolicyPool

Struct PolicyPool 

Source
pub struct PolicyPool { /* private fields */ }
Expand description

Policy and telemetry decorator for pool, session, transaction, and script operations.

Pool methods execute_async/fetch_async acquire a fresh session for each configured retry attempt. Session, transaction, and trusted-script methods do not retry. The total-budget timer is constructed once before acquisition and checked again before each statement dispatch, including after every synchronous hook in nested policy session wrappers. A pre-dispatch rejection remains Cancelled/Timeout and emits no statement events. Already-dispatched success wins simultaneous cancellation/deadline. Other interruptions during dispatch are WriteOutcomeUnknown, even for fetches; authoritative provider unknown-outcome errors are never replaced by cancellation/deadline or retried. Dropping an in-flight observed operation emits one WriteOutcomeUnknown event because dispatch completion cannot be established. Statement events cover execution only; acquisition and transaction begin/commit/rollback boundaries are not separately observed.

Implementations§

Source§

impl PolicyPool

Source

pub fn new<P: Pool + 'static>(pool: P, policy: PoolPolicy) -> Self

Wraps a provider and applies the supplied defaults to operations made through this wrapper.

Source

pub fn from_shared(pool: Arc<dyn Pool>, policy: PoolPolicy) -> Self

Wraps a shared provider trait object with per-pool policy.

Trait Implementations§

Source§

impl Debug for PolicyPool

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Pool for PolicyPool

Source§

fn capabilities(&self) -> Capabilities

Returns capabilities for this provider/configuration.
Source§

fn defaults(&self) -> PoolDefaults

Returns defaults used for options inherited by this pool.
Source§

fn acquire_async(&self) -> DbFuture<'_, Box<dyn Session>>

Acquires one exclusive session; the caller must drop it to release it.
Source§

fn execute_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, u64>

Executes one statement through a newly acquired session with per-query policy overrides. Overrides must reject an explicit fetch limit before dispatch. Read more
Source§

fn fetch_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, Box<dyn Reader + 'a>>

Fetches one bounded batch through a newly acquired session with per-query overrides. Read more
Source§

fn fetch_all_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, Vec<Row>>

Fetches and drains the whole bounded batch using default options. Read more
Source§

fn fetch_first_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, Option<Row>>

Fetches at most the first row of the first result set, then drains the full batch. Read more
Source§

fn fetch_one_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, Row>

Fetches a statement whose first result set must contain exactly one row. Read more
Source§

fn fetch_scalar_async<'a>( &'a self, sql: &'a str, options: QueryOptions, ) -> DbFuture<'a, Value>

Fetches exactly one row and returns its first column. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.