Make ReadStorage more usable

Previously, we were not able to access a `ReadRepository` instance
through `ReadStorage`. With this change, we are able to.
This commit is contained in:
Alexis Sellier
2023-02-15 22:08:20 +01:00
parent 89fcc6de1c
commit 950fae209d
31 changed files with 134 additions and 71 deletions
+5 -1
View File
@@ -411,7 +411,11 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
Input::Fetched(f, result) => {
let result = Rc::try_unwrap(result).unwrap();
if f.initiated {
let mut repo = p.storage().repository(f.rid).unwrap();
let mut repo = match p.storage().repository_mut(f.rid) {
Ok(repo) => repo,
Err(e) if e.is_not_found() => p.storage().create(f.rid).unwrap(),
Err(e) => panic!("Failed to open repository: {e}"),
};
fetch(&mut repo, &f.remote, f.namespaces.clone()).unwrap();
}
p.fetched(f, result);