pub struct Session { /* private fields */ }Expand description
A running pg-ephemeral container marked as a named session.
Pairs the OCI ociman::Container handle with the decoded
Name taken from the container’s pg-ephemeral.session label.
Implementations§
Source§impl Session
impl Session
Sourcepub fn into_ociman_container(self) -> Container
pub fn into_ociman_container(self) -> Container
Consume this session, returning its ociman container handle.
Sourcepub async fn metadata(&self) -> Result<Metadata, MetadataError>
pub async fn metadata(&self) -> Result<Metadata, MetadataError>
Read and decode pg-ephemeral crate::label::Metadata from this
session’s container labels. Used by staleness detection and any
other surface that needs to compare a session’s recorded
configuration to current state.
Sourcepub async fn stop(self) -> Result<(), StopError>
pub async fn stop(self) -> Result<(), StopError>
Stop and remove the underlying container, consuming this Session.
Force-removes via the runtime, which stops the container first if it’s still running. After this call returns successfully the session no longer exists on the backend.
Sourcepub async fn list(backend: &Backend) -> Result<Vec<Self>, ListError>
pub async fn list(backend: &Backend) -> Result<Vec<Self>, ListError>
List every running pg-ephemeral session on the given backend.
Containers are discovered by filtering on the
crate::label::SESSION_KEY label. For each match, the container’s
labels are inspected to decode the session name — so this performs
one ps --filter plus one inspect per match.
Sourcepub async fn find(
backend: &Backend,
name: &Name,
) -> Result<Option<Self>, FindError>
pub async fn find( backend: &Backend, name: &Name, ) -> Result<Option<Self>, FindError>
Look up a session by its user-facing name.
Returns Ok(None) when no session with this name is running.
Multiple matches indicate an invariant violation (the OCI name
derivation enforces uniqueness on start) and surface as
FindError::MultipleMatches.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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 more