pub struct PluginManager { /* private fields */ }Expand description
The entry point for plugin functionality. Use this to list, install, and remove plugins, and to locate plugin binaries for execution.
PluginManager also provides access to the catalogue of available manifests via
the catalogue() function. It also provides for synchronised catalogue updates.
Implementations§
Source§impl PluginManager
impl PluginManager
Sourcepub fn try_default() -> Result<Self>
pub fn try_default() -> Result<Self>
Creates a PluginManager with the default install location.
Sourcepub async fn install(
&self,
plugin_manifest: &PluginManifest,
plugin_package: &PluginPackage,
source: &ManifestLocation,
auth_header_value: &Option<String>,
) -> Result<String>
pub async fn install( &self, plugin_manifest: &PluginManifest, plugin_package: &PluginPackage, source: &ManifestLocation, auth_header_value: &Option<String>, ) -> Result<String>
Installs the Spin plugin with the given manifest If installing a plugin from the centralized Spin plugins repository, it fetches the latest contents of the repository and searches for the appropriately named and versioned plugin manifest. Parses the plugin manifest to get the appropriate source for the machine OS and architecture. Verifies the checksum of the source, unpacks and installs it into the plugins directory. Returns name of plugin that was successfully installed.
Sourcepub async fn install_latest(
&self,
name: &str,
spin_version: &str,
) -> Result<String>
pub async fn install_latest( &self, name: &str, spin_version: &str, ) -> Result<String>
Installs the latest (default) version of the given plugin from the catalogue, checking for compatbility against the given Spin version (unfortunately we can’t infer this because this is a crate not a command).
This is roughly equivalent to spin plugins install <name> with no options.
Sourcepub fn uninstall(&self, plugin_name: &str) -> Result<bool>
pub fn uninstall(&self, plugin_name: &str) -> Result<bool>
Uninstalls a plugin with a given name, removing it and it’s manifest from the local plugins directory. Returns true if plugin was successfully uninstalled and false if plugin did not exist.
Sourcepub fn check_manifest(
&self,
plugin_manifest: &PluginManifest,
spin_version: &str,
override_compatibility_check: bool,
allow_downgrades: bool,
) -> Result<InstallAction>
pub fn check_manifest( &self, plugin_manifest: &PluginManifest, spin_version: &str, override_compatibility_check: bool, allow_downgrades: bool, ) -> Result<InstallAction>
Checks manifest to see if the plugin is compatible with the running version of Spin, does not have a conflicting name with Spin internal commands, and is not a downgrade of a currently installed plugin.
Sourcepub async fn get_manifest(
&self,
manifest_location: &ManifestLocation,
skip_compatibility_check: bool,
spin_version: &str,
auth_header_value: &Option<String>,
) -> PluginLookupResult<PluginManifest>
pub async fn get_manifest( &self, manifest_location: &ManifestLocation, skip_compatibility_check: bool, spin_version: &str, auth_header_value: &Option<String>, ) -> PluginLookupResult<PluginManifest>
Fetches a manifest from a local, remote, or repository location and returned the parsed PluginManifest object.
Sourcepub fn get_installed_manifest(
&self,
plugin_name: &str,
) -> PluginLookupResult<PluginManifest>
pub fn get_installed_manifest( &self, plugin_name: &str, ) -> PluginLookupResult<PluginManifest>
Returns the PluginManifest for an installed plugin with a given name. Looks up and parses the JSON plugin manifest file into object form.
pub fn is_empty(&self) -> bool
pub fn installed_plugins(&self) -> Result<Vec<PluginManifest>>
pub async fn installed_plugins_latest_versions( &self, skip_compatibility_check: bool, spin_version: &str, auth_header_value: &Option<String>, ) -> Result<Vec<(PluginManifest, ManifestLocation)>>
pub fn is_installed(&self, plugin_name: &str) -> bool
pub fn is_installed_exact(&self, manifest: &PluginManifest) -> bool
pub async fn update(&self) -> Result<()>
pub fn catalogue(&self) -> Catalogue
pub fn installed_binary_path(&self, plugin_name: &str) -> PathBuf
Auto Trait Implementations§
impl Freeze for PluginManager
impl RefUnwindSafe for PluginManager
impl Send for PluginManager
impl Sync for PluginManager
impl Unpin for PluginManager
impl UnsafeUnpin for PluginManager
impl UnwindSafe for PluginManager
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<T> ErasedDestructor for Twhere
T: 'static,
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