pub struct DatabaseLease { /* private fields */ }Expand description
Exclusive ownership of one disposable test database.
Dropping a lease enqueues cleanup without waiting for queue capacity. The
fallback retains its connection-budget permit until cleanup finishes, so
saturation delays later database acquisition instead of blocking Drop.
Implementations§
Source§impl DatabaseLease
impl DatabaseLease
pub fn database_name(&self) -> &str
pub fn database_url(&self) -> &str
Sourcepub async fn cleanup(self) -> Result<()>
pub async fn cleanup(self) -> Result<()>
Drops this database and waits for confirmation.
The database’s connection-budget permit remains held until cleanup finishes. A failed database drop closes new database admission for this harness so residual storage remains bounded. Close all application connections and pools before calling.
Sourcepub async fn defer_cleanup(self) -> Result<()>
pub async fn defer_cleanup(self) -> Result<()>
Returns this database to the bounded server-scoped cleanup queue.
This future completes once the queue accepts the database, not when its
DROP finishes. It applies backpressure while the bounded queue is full,
then releases the database’s connection-budget permit. Call
PostgresHarness::drain_deferred_cleanup before process or external
server teardown to await final completion and observe cleanup failures.
A failure that may leave a residual database closes new database
admission for this harness. Close all application connections and pools
before calling.
Trait Implementations§
Source§impl Debug for DatabaseLease
impl Debug for DatabaseLease
Source§impl Drop for DatabaseLease
impl Drop for DatabaseLease
Auto Trait Implementations§
impl Freeze for DatabaseLease
impl RefUnwindSafe for DatabaseLease
impl Send for DatabaseLease
impl Sync for DatabaseLease
impl Unpin for DatabaseLease
impl UnsafeUnpin for DatabaseLease
impl UnwindSafe for DatabaseLease
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request