pub struct WriteClassContext { /* private fields */ }Expand description
What the volume leases taken for a unit of work are recorded as, carried across the threads that work runs on.
The class a lease is recorded as comes from a thread-local scope at the site that takes it. Work that issues writes from one thread and takes the lease on another (the pool’s writer task, a blocking task, a spawned future) loses that scope at the hop; this context carries it. It changes only how a lease is recorded in the lease-hold report, never whether or when a write is admitted.
Implementations§
Source§impl WriteClassContext
impl WriteClassContext
Sourcepub fn migration() -> Self
pub fn migration() -> Self
Schema work: every lease taken under this context is recorded as migration class.
Sourcepub fn capture() -> Self
pub fn capture() -> Self
The calling thread’s current context, to hand to work that runs on another thread.
Sourcepub fn wrap_blocking<F, R>(self, f: F) -> impl FnOnce() -> R + Send
pub fn wrap_blocking<F, R>(self, f: F) -> impl FnOnce() -> R + Send
Wraps a synchronous closure so it runs under this context, on whatever thread calls it.
Sourcepub fn scope_future<F: Future>(self, future: F) -> ScopedFuture<F> ⓘ
pub fn scope_future<F: Future>(self, future: F) -> ScopedFuture<F> ⓘ
Wraps a future so each poll runs under this context. The scope is installed for the poll and removed before it returns, so it never spans a suspension.