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

PackageDatabase

Struct PackageDatabase 

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

On-disk package database

Implementations§

Source§

impl PackageDatabase

Source

pub fn new(db_path: &str) -> Self

Source

pub fn load(&mut self) -> Result<(), KernelError>

Load database from VFS.

If the database file does not exist or the VFS is not available, the in-memory database remains empty – this is not an error.

Source

pub fn save(&self) -> Result<(), KernelError>

Save database to VFS.

Creates parent directories if needed. Silently succeeds if the VFS is not available (early boot).

Source

pub fn record_install(&mut self, record: DbPackageRecord)

Record a package installation.

Source

pub fn record_remove(&mut self, name: &str) -> Option<DbPackageRecord>

Record a package removal.

Returns the removed record so the caller can log or undo it.

Source

pub fn query_installed(&self) -> Vec<&DbPackageRecord>

Query all installed packages.

Source

pub fn is_installed(&self, name: &str) -> bool

Check if a package is installed.

Source

pub fn get(&self, name: &str) -> Option<&DbPackageRecord>

Get a package record by name.

Source

pub fn is_dirty(&self) -> bool

Return whether the database has unsaved changes.

Source

pub fn track_config_file(&mut self, package: &str, config: ConfigRecord)

Record a configuration file for a package.

Source

pub fn is_config_modified(&self, package: &str, path: &str) -> bool

Check whether a config file has been modified by the user.

Source

pub fn list_config_files(&self, package: &str) -> &[ConfigRecord]

List all tracked config files for a package.

Source

pub fn find_orphans(&self) -> Vec<String>

Find orphan packages (packages with zero reverse dependencies).

A package is an orphan if no other installed package depends on it.

Trait Implementations§

Source§

impl Default for PackageDatabase

Available on crate feature alloc only.
Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for PackageDatabase

§

impl RefUnwindSafe for PackageDatabase

§

impl Send for PackageDatabase

§

impl Sync for PackageDatabase

§

impl Unpin for PackageDatabase

§

impl UnwindSafe for PackageDatabase

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.