pub struct ShellSessionRegistry { /* private fields */ }Expand description
Tracks which shell backends are configured and how to reach them.
Cloning shares the same underlying state, so registering a container or SSH server is visible to every holder.
Implementations§
Source§impl ShellSessionRegistry
impl ShellSessionRegistry
Sourcepub const fn new(availability: ShellRuntimeAvailability) -> Self
pub const fn new(availability: ShellRuntimeAvailability) -> Self
Creates a registry advertising the given backends.
Sourcepub const fn with_availability(
self,
availability: ShellRuntimeAvailability,
) -> Self
pub const fn with_availability( self, availability: ShellRuntimeAvailability, ) -> Self
Replaces runtime availability.
The currently advertised backends.
Sourcepub fn with_container_runtime(self, runtime: ContainerShellRuntime) -> Self
pub fn with_container_runtime(self, runtime: ContainerShellRuntime) -> Self
Sets the container runtime.
Sourcepub fn availability(&self) -> ShellRuntimeAvailability
pub fn availability(&self) -> ShellRuntimeAvailability
Returns runtime availability.
Sourcepub fn with_ssh_servers(self, servers: Vec<SshServer>) -> Result<Self, String>
pub fn with_ssh_servers(self, servers: Vec<SshServer>) -> Result<Self, String>
Sets SSH server definitions.
§Errors
Returns an error when a server entry has an empty id/target or duplicates another id.
Sourcepub fn list_ssh_servers(&self) -> Vec<SshServer>
pub fn list_ssh_servers(&self) -> Vec<SshServer>
Every registered SSH server. Lists configured SSH servers.
Sourcepub fn default_ssh_server(&self) -> Result<SshServer, String>
pub fn default_ssh_server(&self) -> Result<SshServer, String>
Returns the default SSH server.
§Errors
Returns an error when no SSH server is configured or more than one server requires disambiguation.
Sourcepub fn resolve_ssh_server(&self, server_id: &str) -> Result<SshServer, String>
pub fn resolve_ssh_server(&self, server_id: &str) -> Result<SshServer, String>
Looks up a registered server by name.
§Errors
Returns an error if server_id is blank, names no registered server, or
the server lock was poisoned.
Sourcepub fn resolve_local_backend(&self) -> Result<ShellBackend, String>
pub fn resolve_local_backend(&self) -> Result<ShellBackend, String>
Picks the backend to use for a command that did not name one.
Prefers a container when one is configured, since it isolates better than running on the host.
§Errors
Returns an error if neither a container nor local execution is available.
Sourcepub fn ensure_ssh_available(&self) -> Result<(), String>
pub fn ensure_ssh_available(&self) -> Result<(), String>
Returns the SSH authorizer when configured.
Source§impl ShellSessionRegistry
impl ShellSessionRegistry
Sourcepub async fn initialize_tools(
self,
distribution: &ToolDistribution,
cache_root: &Path,
) -> Result<Self, ToolRuntimeError>
pub async fn initialize_tools( self, distribution: &ToolDistribution, cache_root: &Path, ) -> Result<Self, ToolRuntimeError>
Prepares every configured environment before an agent can use this registry.
§Errors
Fails on unsupported platforms, missing artifacts, denied SSH provisioning, integrity failures or inconsistent command versions across environments.
Sourcepub fn prepared_catalog(&self) -> Result<&ToolCatalog, ToolRuntimeError>
pub fn prepared_catalog(&self) -> Result<&ToolCatalog, ToolRuntimeError>
Catalog derived only from environments that completed initialization.
§Errors
Rejects an uninitialized registry, or one whose home backend, container or SSH server set changed after preparation.
Trait Implementations§
Source§impl Clone for ShellSessionRegistry
impl Clone for ShellSessionRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ShellSessionRegistry
impl !UnwindSafe for ShellSessionRegistry
impl Freeze for ShellSessionRegistry
impl Send for ShellSessionRegistry
impl Sync for ShellSessionRegistry
impl Unpin for ShellSessionRegistry
impl UnsafeUnpin for ShellSessionRegistry
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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