⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PackageManager

Struct PackageManager 

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

Package manager

Implementations§

Source§

impl PackageManager

Source

pub fn new() -> Self

Source

pub fn signature_policy(&self) -> &SignaturePolicy

Get a reference to the current signature policy.

Source

pub fn set_signature_policy(&mut self, policy: SignaturePolicy)

Replace the signature policy.

Source

pub fn trusted_keys_mut(&mut self) -> &mut TrustedKeyRing

Get a mutable reference to the trusted key ring.

Source

pub fn add_repository(&mut self, repo: Repository)

Add a repository

Source

pub fn install(&mut self, name: String, version_req: String) -> PkgResult<()>

Install a package by name and version.

Uses the default SignaturePolicy – signatures are required and force_unsigned is false.

Source

pub fn install_with_options( &mut self, name: String, version_req: String, options: InstallOptions, ) -> PkgResult<()>

Install a package with explicit install options.

When options.force_unsigned is true, a failed signature verification produces a warning instead of a hard error. A hash mismatch (if expected_hash is provided) always fails regardless.

Source

pub fn remove(&mut self, package_id: &PackageId) -> PkgResult<()>

Remove an installed package

Source

pub fn remove_preserving_configs( &mut self, package_id: &PackageId, ) -> PkgResult<()>

Remove a package, preserving user-modified config files.

Config files that the user has edited are saved with a .bak suffix instead of being deleted.

Source

pub fn remove_orphans(&mut self) -> PkgResult<Vec<PackageId>>

Find and remove orphan packages (packages with no reverse dependencies).

Returns the list of removed package names.

Source

pub fn list_installed(&self) -> Vec<(PackageId, Version)>

List installed packages

Source

pub fn is_installed(&self, package_id: &PackageId) -> bool

Check if package is installed

Source

pub fn get_metadata(&self, package_id: &PackageId) -> Option<&PackageMetadata>

Get installed package metadata

Source

pub fn update(&mut self) -> PkgResult<()>

Update package lists from repositories

Source

pub fn begin_transaction(&mut self) -> PkgResult<()>

Begin an atomic transaction.

All install/remove operations after this call are staged and only applied when commit_transaction() is called. If any operation fails or rollback_transaction() is called, the package state reverts to the snapshot taken here.

Source

pub fn commit_transaction(&mut self) -> PkgResult<()>

Commit the current transaction, persisting state to the database.

Source

pub fn rollback_transaction(&mut self) -> PkgResult<()>

Roll back the current transaction, restoring the pre-transaction state.

Source

pub fn upgrade(&mut self, package_id: &str) -> PkgResult<()>

Upgrade a single installed package to the latest available version.

Source

pub fn upgrade_all(&mut self) -> PkgResult<usize>

Upgrade all installed packages to their latest available versions.

Source

pub fn search(&self, query: &str) -> Vec<(PackageId, Version)>

Search available packages by name substring.

Source

pub fn get_package_info(&self, package_id: &str) -> Option<PackageMetadata>

Get detailed information about a package (installed or available).

Source

pub fn file_manifest(&self) -> &FileManifest

Get a reference to the file manifest.

Source

pub fn file_manifest_mut(&mut self) -> &mut FileManifest

Get a mutable reference to the file manifest.

Source

pub fn database(&self) -> &PackageDatabase

Get a reference to the persistent database.

Source

pub fn database_mut(&mut self) -> &mut PackageDatabase

Get a mutable reference to the persistent database.

Trait Implementations§

Source§

impl Default for PackageManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for PackageManager

§

impl RefUnwindSafe for PackageManager

§

impl Send for PackageManager

§

impl Sync for PackageManager

§

impl Unpin for PackageManager

§

impl UnwindSafe for PackageManager

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.