in src/memory.rs [151:172]
fn update(&mut self, location: &Path, v: UpdateVersion, entry: Entry) -> Result<()> {
match self.map.get_mut(location) {
// Return Precondition instead of NotFound for consistency with stores
None => Err(crate::Error::Precondition {
path: location.to_string(),
source: format!("Object at location {location} not found").into(),
}),
Some(e) => {
let existing = e.e_tag.to_string();
let expected = v.e_tag.ok_or(Error::MissingETag)?;
if existing == expected {
*e = entry;
Ok(())
} else {
Err(crate::Error::Precondition {
path: location.to_string(),
source: format!("{existing} does not match {expected}").into(),
})
}
}
}
}