Database

Struct Database 

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

SQLite database for scan and build caching.

Implementations§

Source§

impl Database

Source

pub fn open(path: &Path) -> Result<Self>

Open or create a database at the given path.

Source

pub fn begin_transaction(&self) -> Result<()>

Begin a transaction.

Source

pub fn commit(&self) -> Result<()>

Commit the current transaction.

Source

pub fn rollback(&self) -> Result<()>

Rollback the current transaction.

Source

pub fn store_package(&self, pkgpath: &str, index: &ScanIndex) -> Result<i64>

Store a package from scan results.

Source

pub fn store_scan_pkgpath( &self, pkgpath: &str, indexes: &[ScanIndex], ) -> Result<()>

Store scan results for a pkgpath.

Source

pub fn get_package_by_name(&self, pkgname: &str) -> Result<Option<PackageRow>>

Get package by name.

Source

pub fn get_package_id(&self, pkgname: &str) -> Result<Option<i64>>

Get package ID by name.

Source

pub fn get_pkgname(&self, package_id: i64) -> Result<String>

Get pkgname by package ID.

Source

pub fn get_packages_by_path(&self, pkgpath: &str) -> Result<Vec<PackageRow>>

Get packages by pkgpath.

Source

pub fn is_pkgpath_scanned(&self, pkgpath: &str) -> Result<bool>

Check if pkgpath is scanned.

Source

pub fn get_scanned_pkgpaths(&self) -> Result<HashSet<String>>

Get all scanned pkgpaths.

Source

pub fn get_unscanned_dependencies(&self) -> Result<HashSet<String>>

Get pkgpaths that are referenced as dependencies but haven’t been scanned yet. These are dependencies that were discovered during scanning but the scan was interrupted before they could be processed.

Source

pub fn count_packages(&self) -> Result<i64>

Count of scanned packages.

Source

pub fn count_scan(&self) -> Result<i64>

Count of scanned pkgpaths.

Source

pub fn get_all_packages(&self) -> Result<Vec<PackageRow>>

Get all packages (lightweight).

Source

pub fn get_buildable_packages(&self) -> Result<Vec<PackageRow>>

Get all buildable packages (no skip/fail reason).

Source

pub fn get_full_scan_index(&self, package_id: i64) -> Result<ScanIndex>

Load full ScanIndex for a package.

Source

pub fn get_all_scan_indexes(&self) -> Result<Vec<(i64, ScanIndex)>>

Load all ScanIndex data in one query.

Source

pub fn get_scan_index_by_name(&self, pkgname: &str) -> Result<Option<ScanIndex>>

Load full ScanIndex by pkgname.

Source

pub fn clear_scan(&self) -> Result<()>

Clear all scan data.

Source

pub fn store_resolved_dependency( &self, package_id: i64, depends_on_id: i64, ) -> Result<()>

Store a resolved dependency.

Source

pub fn store_resolved_dependencies_batch( &self, deps: &[(i64, i64)], ) -> Result<()>

Store resolved dependencies in batch.

Source

pub fn get_dependencies(&self, package_id: i64) -> Result<Vec<i64>>

Get direct dependencies of a package.

Source

pub fn get_reverse_dependencies(&self, package_id: i64) -> Result<Vec<i64>>

Get reverse dependencies (packages that depend on this one).

Source

pub fn get_transitive_reverse_deps(&self, package_id: i64) -> Result<Vec<i64>>

Get all transitive reverse dependencies using recursive CTE.

Source

pub fn is_resolved(&self) -> Result<bool>

Check if dependencies are resolved.

Source

pub fn clear_resolved_depends(&self) -> Result<()>

Clear all resolved dependencies.

Source

pub fn get_raw_dependencies( &self, package_id: i64, ) -> Result<Vec<(String, String)>>

Get raw dependencies for pattern matching.

Source

pub fn store_build_result( &self, package_id: i64, result: &BuildResult, ) -> Result<()>

Store a build result by package ID.

Source

pub fn store_build_by_name(&self, result: &BuildResult) -> Result<()>

Store a build result by pkgname.

Source

pub fn store_build_batch(&self, results: &[BuildResult]) -> Result<()>

Store multiple build results in a transaction.

Source

pub fn get_build_result(&self, package_id: i64) -> Result<Option<BuildResult>>

Get build result for a package.

Source

pub fn is_package_complete(&self, package_id: i64) -> Result<bool>

Check if a package is already built (success or up_to_date).

Source

pub fn is_package_failed(&self, package_id: i64) -> Result<bool>

Check if a package build has failed.

Source

pub fn get_completed_package_ids(&self) -> Result<HashSet<i64>>

Get all completed package IDs.

Source

pub fn get_failed_package_ids(&self) -> Result<HashSet<i64>>

Get all failed package IDs.

Source

pub fn count_build(&self) -> Result<i64>

Count of build results.

Source

pub fn clear_build(&self) -> Result<()>

Clear all build data.

Source

pub fn delete_build_by_name(&self, pkgname: &str) -> Result<bool>

Delete build result for a pkgname.

Source

pub fn delete_build_by_pkgpath(&self, pkgpath: &str) -> Result<usize>

Delete build results by pkgpath.

Source

pub fn get_all_build_results(&self) -> Result<Vec<BuildResult>>

Get all build results from the database.

Source

pub fn count_breaks_for_failed(&self) -> Result<HashMap<String, usize>>

Count how many packages are broken by each failed package. Returns a map from pkgname to the count of packages that depend on it.

Source

pub fn get_total_build_duration(&self) -> Result<Duration>

Get total build duration from all builds.

Source

pub fn get_prefailed_packages( &self, ) -> Result<Vec<(String, Option<String>, String)>>

Get pre-failed packages (those with skip_reason or fail_reason but no build result). Returns (pkgname, pkgpath, reason).

Source

pub fn get_indirect_failures( &self, ) -> Result<Vec<(String, Option<String>, String)>>

Get packages without build results that depend on failed packages. Returns (pkgname, pkgpath, failed_deps) where failed_deps is comma-separated. Excludes packages that have skip_reason or fail_reason (they’re pre-failed). Only lists root failures (direct failures), not indirect failures.

Source

pub fn mark_failure_cascade( &self, package_id: i64, reason: &str, duration: Duration, ) -> Result<usize>

Mark a package and all its transitive reverse dependencies as failed. Returns the count of packages marked.

Source

pub fn full_scan_complete(&self) -> bool

Check if a full tree scan has been completed.

Source

pub fn set_full_scan_complete(&self) -> Result<()>

Mark a full tree scan as complete.

Source

pub fn clear_full_scan_complete(&self) -> Result<()>

Clear the full tree scan complete marker.

Source

pub fn get_buildable_count(&self) -> Result<i64>

Get the buildable package count.

Source

pub fn compare_pkgpath_lists( &self, requested: &[&str], ) -> Result<(Vec<String>, Vec<String>, Vec<String>)>

Compare requested pkgpaths against cached ones.

Source

pub fn delete_pkgpaths(&self, pkgpaths: &[&str]) -> Result<usize>

Delete packages for pkgpaths no longer in the list.

Source

pub fn execute_raw(&self, sql: &str) -> Result<()>

Execute arbitrary SQL and print results.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,