diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 02:13:59 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 02:13:59 +0900 |
| commit | cd25c3e193f05a5e89bca2a1c706c85fdc9c9155 (patch) | |
| tree | 86971cac4e5011af0077416e6ca674c4251496ee /crates/shirabe/src/repository/installed_array_repository.rs | |
| parent | b299a0c9b66523b9630b4cf6d3dca1509c3692b5 (diff) | |
| download | php-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.tar.gz php-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.tar.zst php-shirabe-cd25c3e193f05a5e89bca2a1c706c85fdc9c9155.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/installed_array_repository.rs')
| -rw-r--r-- | crates/shirabe/src/repository/installed_array_repository.rs | 30 |
1 files changed, 20 insertions, 10 deletions
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<crate::package::PackageInterfaceHandle> { + fn get_canonical_packages( + &mut self, + ) -> anyhow::Result<Vec<crate::package::PackageInterfaceHandle>> { todo!() } @@ -96,35 +98,43 @@ impl RepositoryInterface for InstalledArrayRepository { todo!() } fn find_package( - &self, + &mut self, _name: &str, _constraint: FindPackageConstraint, - ) -> Option<BasePackageHandle> { + ) -> anyhow::Result<Option<BasePackageHandle>> { todo!() } fn find_packages( - &self, + &mut self, _name: &str, _constraint: Option<FindPackageConstraint>, - ) -> Vec<BasePackageHandle> { + ) -> anyhow::Result<Vec<BasePackageHandle>> { todo!() } - fn get_packages(&self) -> Vec<BasePackageHandle> { + fn get_packages(&mut self) -> anyhow::Result<Vec<BasePackageHandle>> { todo!() } fn load_packages( - &self, + &mut self, _package_name_map: IndexMap<String, Option<AnyConstraint>>, _acceptable_stabilities: IndexMap<String, i64>, _stability_flags: IndexMap<String, i64>, _already_loaded: IndexMap<String, IndexMap<String, PackageInterfaceHandle>>, - ) -> LoadPackagesResult { + ) -> anyhow::Result<LoadPackagesResult> { todo!() } - fn search(&self, _query: String, _mode: i64, _type: Option<String>) -> Vec<SearchResult> { + fn search( + &mut self, + _query: String, + _mode: i64, + _type: Option<String>, + ) -> anyhow::Result<Vec<SearchResult>> { todo!() } - fn get_providers(&self, _package_name: String) -> IndexMap<String, ProviderInfo> { + fn get_providers( + &mut self, + _package_name: String, + ) -> anyhow::Result<IndexMap<String, ProviderInfo>> { todo!() } fn get_repo_name(&self) -> String { |
