pub struct ContainerStateLock { /* private fields */ }Expand description
Exclusive filesystem lock guarding one service’s state file.
Hold the lock for the whole read-modify-write cycle. The lock is released when the guard drops.
Implementations§
Source§impl ContainerStateLock
impl ContainerStateLock
Sourcepub fn acquire(suite: &TestContainerSuite, service: &str) -> Self
pub fn acquire(suite: &TestContainerSuite, service: &str) -> Self
Acquires the exclusive lock for service within suite, blocking until available.
§Panics
Panics when the lock file cannot be opened or exclusively locked.
Sourcepub fn load(&self) -> SharedContainerState
pub fn load(&self) -> SharedContainerState
Loads the state file, tolerating a missing or empty file.
§Panics
Panics when the state file cannot be read or contains invalid JSON.
Sourcepub fn save(&self, state: &SharedContainerState)
pub fn save(&self, state: &SharedContainerState)
Persists the state file atomically enough for test purposes (write + flush).
§Panics
Panics when state serialization, file creation, writing, or flushing fails.
Auto Trait Implementations§
impl Freeze for ContainerStateLock
impl RefUnwindSafe for ContainerStateLock
impl Send for ContainerStateLock
impl Sync for ContainerStateLock
impl Unpin for ContainerStateLock
impl UnwindSafe for ContainerStateLock
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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>
Wrap the input message
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>,
Applies the layer to a service and wraps it in [
Layered].