pub struct AdapterRegistry { /* private fields */ }Expand description
Registry that maps component IDs to their executor adapters.
The registry maintains two maps:
- Rust adapters: Components with native Rust implementations
- Legacy adapters: Components that fall back to shell scripts
When looking up a component, Rust adapters take priority. If no Rust
adapter is registered, the legacy adapter is used. If neither exists,
AdapterNotFound is returned.
Implementations§
Source§impl AdapterRegistry
impl AdapterRegistry
Sourcepub fn with_legacy(scripts_dir: impl Into<PathBuf>) -> Self
pub fn with_legacy(scripts_dir: impl Into<PathBuf>) -> Self
Create a new adapter registry with the default legacy adapter.
The legacy adapter uses the scripts directory to find install_*.sh files. All 17 known components are registered for legacy fallback.
Sourcepub fn register_rust(
&mut self,
component_id: impl Into<String>,
adapter: Box<dyn Adapter>,
)
pub fn register_rust( &mut self, component_id: impl Into<String>, adapter: Box<dyn Adapter>, )
Register a Rust adapter for a component.
Rust adapters take priority over legacy adapters.
Sourcepub fn get_adapter(
&self,
component_id: &str,
) -> Result<AdapterRef, AdapterError>
pub fn get_adapter( &self, component_id: &str, ) -> Result<AdapterRef, AdapterError>
Look up the adapter info for a component ID.
Returns an AdapterRef describing which executor would be used,
without actually executing anything.
Priority:
- Rust adapter (if registered)
- Legacy adapter (if component has an installer script)
- AdapterNotFound error
Sourcepub fn execute(
&self,
component_id: &str,
version: &str,
) -> Result<AdapterOutput, AdapterError>
pub fn execute( &self, component_id: &str, version: &str, ) -> Result<AdapterOutput, AdapterError>
Execute a component via the appropriate adapter.
Routes to Rust adapter if registered, otherwise falls back to legacy.
Sourcepub fn has_rust_adapter(&self, component_id: &str) -> bool
pub fn has_rust_adapter(&self, component_id: &str) -> bool
Check if a component has a Rust adapter registered.
Sourcepub fn has_legacy_adapter(&self, component_id: &str) -> bool
pub fn has_legacy_adapter(&self, component_id: &str) -> bool
Check if a component has a legacy adapter available.
Sourcepub fn executor_kind(
&self,
component_id: &str,
) -> Result<ExecutorKind, AdapterError>
pub fn executor_kind( &self, component_id: &str, ) -> Result<ExecutorKind, AdapterError>
Get the executor kind for a component.
Sourcepub fn rust_adapter_count(&self) -> usize
pub fn rust_adapter_count(&self) -> usize
Get the number of registered Rust adapters.
Sourcepub fn legacy_adapter_count(&self) -> usize
pub fn legacy_adapter_count(&self) -> usize
Get the number of known legacy component IDs.
Sourcepub fn rust_component_ids(&self) -> Vec<String>
pub fn rust_component_ids(&self) -> Vec<String>
List all component IDs that have Rust adapters registered.
Sourcepub fn legacy_component_ids(&self) -> Vec<String>
pub fn legacy_component_ids(&self) -> Vec<String>
List all component IDs that have legacy adapters available.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AdapterRegistry
impl !UnwindSafe for AdapterRegistry
impl Freeze for AdapterRegistry
impl Send for AdapterRegistry
impl Sync for AdapterRegistry
impl Unpin for AdapterRegistry
impl UnsafeUnpin for AdapterRegistry
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
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