diff options
Diffstat (limited to 'crates/shirabe/src/repository/repository_interface.rs')
| -rw-r--r-- | crates/shirabe/src/repository/repository_interface.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/shirabe/src/repository/repository_interface.rs b/crates/shirabe/src/repository/repository_interface.rs index 6dbc01da..ab25242c 100644 --- a/crates/shirabe/src/repository/repository_interface.rs +++ b/crates/shirabe/src/repository/repository_interface.rs @@ -52,9 +52,13 @@ pub const SEARCH_NAME: i64 = 1; pub const SEARCH_VENDOR: i64 = 2; pub trait RepositoryInterface: std::fmt::Debug { - fn count(&self) -> anyhow::Result<usize>; + // count/has_package take &mut self (and has_package returns Result) because PHP's + // ArrayRepository::count()/hasPackage() late-bind $this->initialize() to the concrete + // repository class, which lazily loads packages and can throw; lazy repositories need the + // same guard here (see FilesystemRepository/PlatformRepository/ComposerRepository). + fn count(&mut self) -> anyhow::Result<usize>; - fn has_package(&self, package: PackageInterfaceHandle) -> bool; + fn has_package(&mut self, package: PackageInterfaceHandle) -> anyhow::Result<bool>; fn find_package( &mut self, |
