Skip to main content

ContainerState

Struct ContainerState 

Source
pub struct ContainerState { /* private fields */ }
Expand description

Always-present container-domain state: cache and cross-host pending operations. Separate from ContainerSession, which is the per-host overlay session state.

Implementations§

Source§

impl ContainerState

Source

pub fn cache(&self) -> &HashMap<String, ContainerCacheEntry>

Source

pub fn set_cache(&mut self, cache: HashMap<String, ContainerCacheEntry>)

Source

pub fn cache_entry(&self, alias: &str) -> Option<&ContainerCacheEntry>

Source

pub fn cache_entry_mut( &mut self, alias: &str, ) -> Option<&mut ContainerCacheEntry>

Source

pub fn cache_contains(&self, alias: &str) -> bool

Source

pub fn cache_len(&self) -> usize

Source

pub fn insert_cache_entry(&mut self, alias: String, entry: ContainerCacheEntry)

Source

pub fn remove_cache_entry(&mut self, alias: &str)

Source

pub fn clear_cache(&mut self)

Source

pub fn pending_exec_request(&self) -> Option<&ContainerExecRequest>

Source

pub fn pending_logs_request(&self) -> Option<&ContainerLogsRequest>

Source

pub fn has_pending_fetches(&self) -> bool

Source

pub fn pending_actions_len(&self) -> usize

Source

pub fn take_pending_exec(&mut self) -> Option<ContainerExecRequest>

Source

pub fn take_pending_logs(&mut self) -> Option<ContainerLogsRequest>

Source

pub fn pop_next_action(&mut self) -> Option<ContainerActionRequest>

Source

pub fn pending_actions_iter( &self, ) -> impl Iterator<Item = &ContainerActionRequest>

Source

pub fn pending_actions_at(&self, idx: usize) -> Option<&ContainerActionRequest>

Source

pub fn pending_fetch_aliases(&self) -> &[String]

Source

pub fn extend_pending_fetches<I: IntoIterator<Item = String>>( &mut self, iter: I, )

Source

pub fn queue_logs(&mut self, req: ContainerLogsRequest)

Queue a logs request for the main loop to drain. Replaces any previous pending logs request and logs the displaced alias so a dropped request is traceable.

Source

pub fn queue_exec(&mut self, req: ContainerExecRequest)

Queue an exec request for the main loop to drain. Same replace and log semantics as queue_logs.

Source

pub fn queue_action(&mut self, req: ContainerActionRequest)

Queue a non-interactive container action for the worker thread. Actions are FIFO via VecDeque::push_back; multiple actions against the same alias process in order.

Source

pub fn queue_fetch(&mut self, alias: String)

Enqueue an alias for the initial container-cache fetch. Drained by the main loop on the next tick via drain_pending_fetches.

Source

pub fn drain_pending_fetches(&mut self) -> Vec<String>

Take the full fetch queue, leaving it empty.

Source

pub fn prune_orphans(&mut self, valid_aliases: &HashSet<&str>) -> bool

Drop cache entries whose host alias is no longer in valid_aliases. Returns true when anything was dropped so the caller can persist the trimmed cache via containers::save_container_cache. The cache is also the source of valid container IDs for downstream inspect/logs pruning.

Source

pub fn migrate_alias(&mut self, old: &str, new: &str) -> bool

Move a cache entry from old to new on host rename. Returns true when the cache changed so the caller can persist. No-op (returns false) when old == new or no entry exists under old.

Trait Implementations§

Source§

impl Debug for ContainerState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ContainerState

Source§

fn default() -> ContainerState

Returns the “default value” for a type. 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<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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V