| ... | ... | @@ -150,7 +150,18 @@ impl Served { |
| 150 | 150 | None => self |
| 151 | 151 | .storage |
| 152 | 152 | .confirm(path, &Stamp::of(&image).expect("section stamp")) |
| 153 | | .map_err(Error::from), |
| 153 | .map_err(Error::from) |
| 154 | .and_then(|()| { |
| 155 | image = self.image(path).map_err(|error| CommitError { |
| 156 | state: CommitState::Committed, |
| 157 | error: match error { |
| 158 | Error::Io(error) | Error::RemoteIo(error) => error, |
| 159 | Error::Remote(error) => error.error, |
| 160 | error => io::Error::other(error), |
| 161 | }, |
| 162 | })?; |
| 163 | Ok(()) |
| 164 | }), |
| 154 | 165 | }; |
| 155 | 166 | if result.is_ok() { |
| 156 | 167 | self.tell_delta(path, &before, &image, None); |
| ... | ... | @@ -413,6 +424,17 @@ mod tests { |
| 413 | 424 | let repeated = served.batch(&peer, request).unwrap(); |
| 414 | 425 | assert!(repeated.failure.is_none(), "{:?}", repeated.failure); |
| 415 | 426 | let replayed = std::fs::read(folder.join(path)).unwrap(); |
| 427 | let confirmed = Stamp::of(&replayed).unwrap(); |
| 428 | assert_eq!( |
| 429 | Stamp::try_from(repeated.stamp.as_ref().unwrap()).unwrap(), |
| 430 | confirmed |
| 431 | ); |
| 432 | { |
| 433 | let images = served.images.lock().unwrap(); |
| 434 | let (_, held, image) = images.iter().find(|(held, _, _)| held == path).unwrap(); |
| 435 | assert_eq!(*held, confirmed); |
| 436 | assert_eq!(**image, replayed); |
| 437 | } |
| 416 | 438 | assert_eq!(&replayed[1024..], &committed[1024..]); |
| 417 | 439 | let replay_arena = Arena::default(); |
| 418 | 440 | let replay = Section::open(&replay_arena, replayed).unwrap(); |