pub struct SharedContainerState { /* private fields */ }Expand description
Serializable registry of test processes and the resources they created.
Implementations§
Sourcepub fn register_pid(&mut self, pid: u32)
pub fn register_pid(&mut self, pid: u32)
Registers a live process id.
Sourcepub fn register_current_process(&mut self)
pub fn register_current_process(&mut self)
Registers the current test process and its nextest run, when present.
Sourcepub fn remember_resource(&mut self, pid: u32, resource: &str)
pub fn remember_resource(&mut self, pid: u32, resource: &str)
Records a resource (for example a per-test database name) owned by pid.
Sourcepub fn remember_current_process_resource(&mut self, resource: &str)
pub fn remember_current_process_resource(&mut self, resource: &str)
Records a resource owned by the current test process and nextest run.
Sourcepub fn forget_resource(&mut self, pid: u32, resource: &str)
pub fn forget_resource(&mut self, pid: u32, resource: &str)
Removes one resource from pid after the owning test cleaned it up successfully.
Records a suite-scoped resource that must survive the producer process.
Products use this for durable test fixtures such as a migrated template database. Unlike
per-process resources, these entries are never returned by Self::prune_stale; the
product owns fingerprint-based invalidation and explicit cleanup.
Removes a suite-scoped resource after explicit product cleanup.
Returns suite-scoped resources retained independently of a producer PID.
Sourcepub fn endpoint(&self) -> Option<&SharedContainerEndpoint>
pub fn endpoint(&self) -> Option<&SharedContainerEndpoint>
Returns the last verified reusable-container endpoint.
Sourcepub fn set_endpoint(&mut self, endpoint: SharedContainerEndpoint)
pub fn set_endpoint(&mut self, endpoint: SharedContainerEndpoint)
Publishes the last verified reusable-container endpoint.
Sourcepub fn clear_endpoint(&mut self)
pub fn clear_endpoint(&mut self)
Clears an endpoint that no longer accepts a readiness probe.
Sourcepub fn live_resources(&self) -> Vec<&str>
pub fn live_resources(&self) -> Vec<&str>
Returns resources attributed to registered processes.
This can include resources from processes that exited during the current nextest run.
Sourcepub fn prune_stale(&mut self) -> Vec<String>
pub fn prune_stale(&mut self) -> Vec<String>
Removes entries whose process no longer exists and returns the orphaned resources.
Sourcepub fn prune_stale_before_current_execution(&mut self) -> Vec<String>
pub fn prune_stale_before_current_execution(&mut self) -> Vec<String>
Prunes resources from previous executions while retaining dead processes from this nextest run until the run finishes.
Deferring same-run cleanup avoids interleaving large schema drops with schema creation in
process-per-test database suites. A later run has a different NEXTEST_RUN_ID and reclaims
the retained resources deterministically.
Trait Implementations§
Source§fn default() -> SharedContainerState
fn default() -> SharedContainerState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].