Skip to main content

Session

Struct Session 

Source
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

Source

pub fn name(&self) -> &Name

The user-facing session name.

Source

pub fn container(&self) -> &Container

The underlying container handle.

Source

pub fn into_ociman_container(self) -> Container

Consume this session, returning its ociman container handle.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Debug for Session

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more