From cd25c3e193f05a5e89bca2a1c706c85fdc9c9155 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 02:13:59 +0900 Subject: refactor(repository): make read methods fallible and take &mut self Change RepositoryInterface and WritableRepositoryInterface read methods (find_package, find_packages, get_packages, load_packages, search, get_providers, get_canonical_packages) to take &mut self and return anyhow::Result, so lazy-loading repositories such as ComposerRepository can perform fallible I/O and mutate internal state on access. Update all implementors and call sites to propagate the Result and pass mutable references. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/repository/installed_array_repository.rs | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/src/repository/installed_array_repository.rs') diff --git a/crates/shirabe/src/repository/installed_array_repository.rs b/crates/shirabe/src/repository/installed_array_repository.rs index 1520497..2d3965b 100644 --- a/crates/shirabe/src/repository/installed_array_repository.rs +++ b/crates/shirabe/src/repository/installed_array_repository.rs @@ -68,7 +68,9 @@ impl WritableRepositoryInterface for InstalledArrayRepository { todo!() } - fn get_canonical_packages(&self) -> Vec { + fn get_canonical_packages( + &mut self, + ) -> anyhow::Result> { todo!() } @@ -96,35 +98,43 @@ impl RepositoryInterface for InstalledArrayRepository { todo!() } fn find_package( - &self, + &mut self, _name: &str, _constraint: FindPackageConstraint, - ) -> Option { + ) -> anyhow::Result> { todo!() } fn find_packages( - &self, + &mut self, _name: &str, _constraint: Option, - ) -> Vec { + ) -> anyhow::Result> { todo!() } - fn get_packages(&self) -> Vec { + fn get_packages(&mut self) -> anyhow::Result> { todo!() } fn load_packages( - &self, + &mut self, _package_name_map: IndexMap>, _acceptable_stabilities: IndexMap, _stability_flags: IndexMap, _already_loaded: IndexMap>, - ) -> LoadPackagesResult { + ) -> anyhow::Result { todo!() } - fn search(&self, _query: String, _mode: i64, _type: Option) -> Vec { + fn search( + &mut self, + _query: String, + _mode: i64, + _type: Option, + ) -> anyhow::Result> { todo!() } - fn get_providers(&self, _package_name: String) -> IndexMap { + fn get_providers( + &mut self, + _package_name: String, + ) -> anyhow::Result> { todo!() } fn get_repo_name(&self) -> String { -- cgit v1.3.1