pub struct Database { /* private fields */ }Expand description
SQLite database for scan and build caching.
Implementations§
Source§impl Database
impl Database
Sourcepub fn store_package(&self, pkgpath: &str, index: &ScanIndex) -> Result<i64>
pub fn store_package(&self, pkgpath: &str, index: &ScanIndex) -> Result<i64>
Store a package from scan results.
Sourcepub fn store_scan_pkgpath(
&self,
pkgpath: &str,
indexes: &[ScanIndex],
) -> Result<()>
pub fn store_scan_pkgpath( &self, pkgpath: &str, indexes: &[ScanIndex], ) -> Result<()>
Store scan results for a pkgpath.
Sourcepub fn get_package_by_name(&self, pkgname: &str) -> Result<Option<PackageRow>>
pub fn get_package_by_name(&self, pkgname: &str) -> Result<Option<PackageRow>>
Get package by name.
Sourcepub fn get_pkgname(&self, package_id: i64) -> Result<String>
pub fn get_pkgname(&self, package_id: i64) -> Result<String>
Get pkgname by package ID.
Sourcepub fn get_packages_by_path(&self, pkgpath: &str) -> Result<Vec<PackageRow>>
pub fn get_packages_by_path(&self, pkgpath: &str) -> Result<Vec<PackageRow>>
Get packages by pkgpath.
Sourcepub fn is_pkgpath_scanned(&self, pkgpath: &str) -> Result<bool>
pub fn is_pkgpath_scanned(&self, pkgpath: &str) -> Result<bool>
Check if pkgpath is scanned.
Sourcepub fn get_scanned_pkgpaths(&self) -> Result<HashSet<String>>
pub fn get_scanned_pkgpaths(&self) -> Result<HashSet<String>>
Get all scanned pkgpaths.
Sourcepub fn get_unscanned_dependencies(&self) -> Result<HashSet<String>>
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.
Sourcepub fn count_packages(&self) -> Result<i64>
pub fn count_packages(&self) -> Result<i64>
Count of scanned packages.
Sourcepub fn count_scan(&self) -> Result<i64>
pub fn count_scan(&self) -> Result<i64>
Count of scanned pkgpaths.
Sourcepub fn get_all_packages(&self) -> Result<Vec<PackageRow>>
pub fn get_all_packages(&self) -> Result<Vec<PackageRow>>
Get all packages (lightweight).
Sourcepub fn get_buildable_packages(&self) -> Result<Vec<PackageRow>>
pub fn get_buildable_packages(&self) -> Result<Vec<PackageRow>>
Get all buildable packages (no skip/fail reason).
Sourcepub fn get_full_scan_index(&self, package_id: i64) -> Result<ScanIndex>
pub fn get_full_scan_index(&self, package_id: i64) -> Result<ScanIndex>
Load full ScanIndex for a package.
Sourcepub fn get_scan_index_by_name(&self, pkgname: &str) -> Result<Option<ScanIndex>>
pub fn get_scan_index_by_name(&self, pkgname: &str) -> Result<Option<ScanIndex>>
Load full ScanIndex by pkgname.
Sourcepub fn clear_scan(&self) -> Result<()>
pub fn clear_scan(&self) -> Result<()>
Clear all scan data.
Sourcepub fn store_resolved_dependency(
&self,
package_id: i64,
depends_on_id: i64,
) -> Result<()>
pub fn store_resolved_dependency( &self, package_id: i64, depends_on_id: i64, ) -> Result<()>
Store a resolved dependency.
Sourcepub fn store_resolved_dependencies_batch(
&self,
deps: &[(i64, i64)],
) -> Result<()>
pub fn store_resolved_dependencies_batch( &self, deps: &[(i64, i64)], ) -> Result<()>
Store resolved dependencies in batch.
Sourcepub fn get_dependencies(&self, package_id: i64) -> Result<Vec<i64>>
pub fn get_dependencies(&self, package_id: i64) -> Result<Vec<i64>>
Get direct dependencies of a package.
Sourcepub fn get_reverse_dependencies(&self, package_id: i64) -> Result<Vec<i64>>
pub fn get_reverse_dependencies(&self, package_id: i64) -> Result<Vec<i64>>
Get reverse dependencies (packages that depend on this one).
Sourcepub fn get_transitive_reverse_deps(&self, package_id: i64) -> Result<Vec<i64>>
pub fn get_transitive_reverse_deps(&self, package_id: i64) -> Result<Vec<i64>>
Get all transitive reverse dependencies using recursive CTE.
Sourcepub fn is_resolved(&self) -> Result<bool>
pub fn is_resolved(&self) -> Result<bool>
Check if dependencies are resolved.
Sourcepub fn clear_resolved_depends(&self) -> Result<()>
pub fn clear_resolved_depends(&self) -> Result<()>
Clear all resolved dependencies.
Sourcepub fn get_raw_dependencies(
&self,
package_id: i64,
) -> Result<Vec<(String, String)>>
pub fn get_raw_dependencies( &self, package_id: i64, ) -> Result<Vec<(String, String)>>
Get raw dependencies for pattern matching.
Sourcepub fn store_build_result(
&self,
package_id: i64,
result: &BuildResult,
) -> Result<()>
pub fn store_build_result( &self, package_id: i64, result: &BuildResult, ) -> Result<()>
Store a build result by package ID.
Sourcepub fn store_build_by_name(&self, result: &BuildResult) -> Result<()>
pub fn store_build_by_name(&self, result: &BuildResult) -> Result<()>
Store a build result by pkgname.
Sourcepub fn store_build_batch(&self, results: &[BuildResult]) -> Result<()>
pub fn store_build_batch(&self, results: &[BuildResult]) -> Result<()>
Store multiple build results in a transaction.
Sourcepub fn get_build_result(&self, package_id: i64) -> Result<Option<BuildResult>>
pub fn get_build_result(&self, package_id: i64) -> Result<Option<BuildResult>>
Get build result for a package.
Sourcepub fn is_package_complete(&self, package_id: i64) -> Result<bool>
pub fn is_package_complete(&self, package_id: i64) -> Result<bool>
Check if a package is already built (success or up_to_date).
Sourcepub fn is_package_failed(&self, package_id: i64) -> Result<bool>
pub fn is_package_failed(&self, package_id: i64) -> Result<bool>
Check if a package build has failed.
Sourcepub fn get_completed_package_ids(&self) -> Result<HashSet<i64>>
pub fn get_completed_package_ids(&self) -> Result<HashSet<i64>>
Get all completed package IDs.
Sourcepub fn get_failed_package_ids(&self) -> Result<HashSet<i64>>
pub fn get_failed_package_ids(&self) -> Result<HashSet<i64>>
Get all failed package IDs.
Sourcepub fn count_build(&self) -> Result<i64>
pub fn count_build(&self) -> Result<i64>
Count of build results.
Sourcepub fn clear_build(&self) -> Result<()>
pub fn clear_build(&self) -> Result<()>
Clear all build data.
Sourcepub fn delete_build_by_name(&self, pkgname: &str) -> Result<bool>
pub fn delete_build_by_name(&self, pkgname: &str) -> Result<bool>
Delete build result for a pkgname.
Sourcepub fn delete_build_by_pkgpath(&self, pkgpath: &str) -> Result<usize>
pub fn delete_build_by_pkgpath(&self, pkgpath: &str) -> Result<usize>
Delete build results by pkgpath.
Sourcepub fn get_all_build_results(&self) -> Result<Vec<BuildResult>>
pub fn get_all_build_results(&self) -> Result<Vec<BuildResult>>
Get all build results from the database.
Sourcepub fn count_breaks_for_failed(&self) -> Result<HashMap<String, usize>>
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.
Sourcepub fn get_total_build_duration(&self) -> Result<Duration>
pub fn get_total_build_duration(&self) -> Result<Duration>
Get total build duration from all builds.
Sourcepub fn mark_failure_cascade(
&self,
package_id: i64,
reason: &str,
duration: Duration,
) -> Result<usize>
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.
Sourcepub fn full_scan_complete(&self) -> bool
pub fn full_scan_complete(&self) -> bool
Check if a full tree scan has been completed.
Sourcepub fn set_full_scan_complete(&self) -> Result<()>
pub fn set_full_scan_complete(&self) -> Result<()>
Mark a full tree scan as complete.
Sourcepub fn clear_full_scan_complete(&self) -> Result<()>
pub fn clear_full_scan_complete(&self) -> Result<()>
Clear the full tree scan complete marker.
Sourcepub fn get_buildable_count(&self) -> Result<i64>
pub fn get_buildable_count(&self) -> Result<i64>
Get the buildable package count.
Sourcepub fn compare_pkgpath_lists(
&self,
requested: &[&str],
) -> Result<(Vec<String>, Vec<String>, Vec<String>)>
pub fn compare_pkgpath_lists( &self, requested: &[&str], ) -> Result<(Vec<String>, Vec<String>, Vec<String>)>
Compare requested pkgpaths against cached ones.
Sourcepub fn delete_pkgpaths(&self, pkgpaths: &[&str]) -> Result<usize>
pub fn delete_pkgpaths(&self, pkgpaths: &[&str]) -> Result<usize>
Delete packages for pkgpaths no longer in the list.
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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