aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/installer/noop_installer.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-18 18:16:07 +0900
committernsfisis <nsfisis@gmail.com>2026-07-18 18:16:07 +0900
commit307e66847dd5e00ad1890b6a64d3ac7192a03efc (patch)
treebdd4657d350a886d7d28dcb5187395771c99943b /crates/shirabe/src/installer/noop_installer.rs
parent9b291d454b059977639db26c847af4e835cda0c3 (diff)
downloadphp-shirabe-307e66847dd5e00ad1890b6a64d3ac7192a03efc.tar.gz
php-shirabe-307e66847dd5e00ad1890b6a64d3ac7192a03efc.tar.zst
php-shirabe-307e66847dd5e00ad1890b6a64d3ac7192a03efc.zip
perf(installation-manager): fan out package downloads via Loop::wait
InstallationManager::downloadAndExecuteBatch now matches PHP: every update/install operation's installer->download() promise is collected and driven concurrently through waitOnPromises()/Loop::wait instead of being awaited one package at a time. Concurrency caps stay where PHP puts them (HttpDownloader 12, ProcessExecutor 10 via their semaphores). Error semantics follow PHP too: all downloads settle before the first rejection is rethrown, rather than aborting on the first failure. To let the collected futures and the cleanup closures own their installer beyond the loop iteration that created them, the installer registry becomes Vec<Rc<dyn InstallerInterface>> and get_installer hands out clones (PHP closures capture $installer the same way), with InstallerInterface methods taking &self across the six implementors — the only genuinely mutable state was LibraryInstaller.vendor_dir (canonicalized in place), now behind a RefCell. as_plugin_installer_mut/as_binary_presence_interface lose their &mut. The cleanup_promises entries are now the real thing: the PHP closure including the getInstallationSource() guard and the installer->cleanup($opType, $package, $initialPackage) call, replacing the no-op futures (drops one TODO(phase-b) and two TODO(phase-c)). Verified against the real network: create-project laravel/laravel produces a vendor tree byte-identical to real Composer's (diff -rq clean across all 109 packages including vendor/composer). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/installer/noop_installer.rs')
-rw-r--r--crates/shirabe/src/installer/noop_installer.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/shirabe/src/installer/noop_installer.rs b/crates/shirabe/src/installer/noop_installer.rs
index 9b8aa087..62e5de78 100644
--- a/crates/shirabe/src/installer/noop_installer.rs
+++ b/crates/shirabe/src/installer/noop_installer.rs
@@ -15,7 +15,7 @@ impl InstallerInterface for NoopInstaller {
}
fn is_installed(
- &mut self,
+ &self,
repo: &dyn InstalledRepositoryInterface,
package: PackageInterfaceHandle,
) -> bool {
@@ -23,7 +23,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn download(
- &mut self,
+ &self,
_package: PackageInterfaceHandle,
_prev_package: Option<PackageInterfaceHandle>,
) -> anyhow::Result<Option<PhpMixed>> {
@@ -31,7 +31,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn prepare(
- &mut self,
+ &self,
_type: &str,
_package: PackageInterfaceHandle,
_prev_package: Option<PackageInterfaceHandle>,
@@ -40,7 +40,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn cleanup(
- &mut self,
+ &self,
_type: &str,
_package: PackageInterfaceHandle,
_prev_package: Option<PackageInterfaceHandle>,
@@ -49,7 +49,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn install(
- &mut self,
+ &self,
repo: &mut dyn InstalledRepositoryInterface,
package: PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
@@ -61,7 +61,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn update(
- &mut self,
+ &self,
repo: &mut dyn InstalledRepositoryInterface,
initial: PackageInterfaceHandle,
target: PackageInterfaceHandle,
@@ -83,7 +83,7 @@ impl InstallerInterface for NoopInstaller {
}
async fn uninstall(
- &mut self,
+ &self,
repo: &mut dyn InstalledRepositoryInterface,
package: PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
@@ -99,7 +99,7 @@ impl InstallerInterface for NoopInstaller {
Ok(None)
}
- fn get_install_path(&mut self, package: PackageInterfaceHandle) -> Option<String> {
+ fn get_install_path(&self, package: PackageInterfaceHandle) -> Option<String> {
let target_dir = package.get_target_dir();
let pretty_name = package.get_pretty_name();