pub struct InstallDriver { /* private fields */ }Expand description
Packages can mostly be installed in isolation and therefore in parallel.
However, when installing a large number of packages at the same time the
different installation tasks start competing for resources. The
InstallDriver helps to assist in making sure that tasks don’t starve
each other from resource as well as making sure that due to the large number
of requests the process doesn’t try to acquire more resources than the
system has available.
Implementations§
Source§impl InstallDriver
impl InstallDriver
Sourcepub fn builder() -> InstallDriverBuilder
pub fn builder() -> InstallDriverBuilder
Constructs a builder to configure a new InstallDriver.
Sourcepub async fn acquire_io_permit(
&self,
) -> Result<Option<OwnedSemaphorePermit>, AcquireError>
pub async fn acquire_io_permit( &self, ) -> Result<Option<OwnedSemaphorePermit>, AcquireError>
Returns a permit that will allow the caller to perform IO operations. This is used to make sure that the system doesn’t try to acquire more IO resources than the system has available.
Sourcepub fn clobber_registry(&self) -> MutexGuard<'_, ClobberRegistry>
pub fn clobber_registry(&self) -> MutexGuard<'_, ClobberRegistry>
Return a locked reference to the paths registry. This is used to make sure that the same path is not installed twice.
Sourcepub fn pre_process<Old: Borrow<PrefixRecord>, New>(
&self,
transaction: &Transaction<Old, New>,
target_prefix: &Path,
reporter: Option<&dyn Reporter>,
) -> Result<Option<PrePostLinkResult>, PrePostLinkError>
pub fn pre_process<Old: Borrow<PrefixRecord>, New>( &self, transaction: &Transaction<Old, New>, target_prefix: &Path, reporter: Option<&dyn Reporter>, ) -> Result<Option<PrePostLinkResult>, PrePostLinkError>
Call this before any packages are installed to perform any pre processing that is required.
Sourcepub async fn run_blocking_io_task<T: Send + 'static, E: Send + From<Cancelled> + 'static, F: FnOnce() -> Result<T, E> + Send + 'static>(
&self,
f: F,
) -> Result<T, E>
pub async fn run_blocking_io_task<T: Send + 'static, E: Send + From<Cancelled> + 'static, F: FnOnce() -> Result<T, E> + Send + 'static>( &self, f: F, ) -> Result<T, E>
Runs a blocking task that will execute on a separate thread. The task is not started until an IO permit is acquired. This is used to make sure that the system doesn’t try to acquire more IO resources than the system has available.
Sourcepub fn post_process<Old: Borrow<PrefixRecord> + AsRef<New>, New: AsRef<PackageRecord>>(
&self,
transaction: &Transaction<Old, New>,
target_prefix: &Prefix,
reporter: Option<&dyn Reporter>,
) -> Result<PostProcessResult, PostProcessingError>
pub fn post_process<Old: Borrow<PrefixRecord> + AsRef<New>, New: AsRef<PackageRecord>>( &self, transaction: &Transaction<Old, New>, target_prefix: &Prefix, reporter: Option<&dyn Reporter>, ) -> Result<PostProcessResult, PostProcessingError>
Call this after all packages have been installed to perform any post processing that is required.
This function will select a winner among multiple packages that might
write to a single package and will also execute any
post-link.sh/bat scripts
Sourcepub fn remove_empty_directories<Old: Borrow<PrefixRecord>, New>(
&self,
operations: &[TransactionOperation<Old, New>],
new_prefix_records: &[PrefixRecord],
target_prefix: &Path,
) -> Result<(), UnlinkError>
pub fn remove_empty_directories<Old: Borrow<PrefixRecord>, New>( &self, operations: &[TransactionOperation<Old, New>], new_prefix_records: &[PrefixRecord], target_prefix: &Path, ) -> Result<(), UnlinkError>
Remove all empty directories that are not part of the new prefix records.
Source§impl InstallDriver
impl InstallDriver
Sourcepub fn run_post_link_scripts<Old, New>(
&self,
transaction: &Transaction<Old, New>,
prefix_records: &[&PrefixRecord],
target_prefix: &Path,
reporter: Option<&dyn Reporter>,
) -> Result<PrePostLinkResult, LinkScriptError>
pub fn run_post_link_scripts<Old, New>( &self, transaction: &Transaction<Old, New>, prefix_records: &[&PrefixRecord], target_prefix: &Path, reporter: Option<&dyn Reporter>, ) -> Result<PrePostLinkResult, LinkScriptError>
Run any post-link scripts that are part of the packages that are being installed.
Sourcepub fn run_pre_unlink_scripts<Old, New>(
&self,
transaction: &Transaction<Old, New>,
target_prefix: &Path,
reporter: Option<&dyn Reporter>,
) -> Result<PrePostLinkResult, LinkScriptError>where
Old: Borrow<PrefixRecord>,
pub fn run_pre_unlink_scripts<Old, New>(
&self,
transaction: &Transaction<Old, New>,
target_prefix: &Path,
reporter: Option<&dyn Reporter>,
) -> Result<PrePostLinkResult, LinkScriptError>where
Old: Borrow<PrefixRecord>,
Run any pre-unlink scripts that are part of the packages that are being removed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InstallDriver
impl !RefUnwindSafe for InstallDriver
impl Send for InstallDriver
impl Sync for InstallDriver
impl Unpin for InstallDriver
impl !UnwindSafe for InstallDriver
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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