Fix for new Store::update() interface
This commit is contained in:
parent
a53547e08a
commit
1c43abb0b0
2 changed files with 9 additions and 7 deletions
|
@ -426,7 +426,8 @@ methods!(
|
||||||
store <- itself wrapped inside STORE_WRAPPER,
|
store <- itself wrapped inside STORE_WRAPPER,
|
||||||
real_fle <- fetch fle,
|
real_fle <- fetch fle,
|
||||||
operation {
|
operation {
|
||||||
if let Err(e) = store.update(real_fle) {
|
let mut real_fle = real_fle; // rebind for mut
|
||||||
|
if let Err(e) = store.update(&mut real_fle) {
|
||||||
trace_error(&e);
|
trace_error(&e);
|
||||||
VM::raise(Class::from_existing("RuntimeError"), e.description());
|
VM::raise(Class::from_existing("RuntimeError"), e.description());
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,7 +606,7 @@ impl Store {
|
||||||
///
|
///
|
||||||
/// See `Store::_update()`.
|
/// See `Store::_update()`.
|
||||||
///
|
///
|
||||||
pub fn update<'a>(&'a self, mut entry: &FileLockEntry<'a>) -> Result<()> {
|
pub fn update<'a>(&'a self, entry: &mut FileLockEntry<'a>) -> Result<()> {
|
||||||
self._update(entry, false).map_err_into(SEK::UpdateCallError)
|
self._update(entry, false).map_err_into(SEK::UpdateCallError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2007,7 +2007,8 @@ aspect = "test"
|
||||||
{
|
{
|
||||||
println!("Getting {:?} -> Some -> updating", pb_moved);
|
println!("Getting {:?} -> Some -> updating", pb_moved);
|
||||||
assert!(match store.get(pb_moved.clone()).map_err(|e| println!("ERROR GETTING: {:?}", e)) {
|
assert!(match store.get(pb_moved.clone()).map_err(|e| println!("ERROR GETTING: {:?}", e)) {
|
||||||
Ok(Some(fle)) => store.update(fle).map_err(|e| println!("ERROR UPDATING: {:?}", e)).is_ok(),
|
Ok(Some(fle)) => store.update(&mut fle)
|
||||||
|
.map_err(|e| println!("ERROR UPDATING: {:?}", e)).is_ok(),
|
||||||
_ => false,
|
_ => false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2112,7 +2113,7 @@ aspect = "test"
|
||||||
let store = get_store_with_aborting_hook_at_pos(HP::PreUpdate);
|
let store = get_store_with_aborting_hook_at_pos(HP::PreUpdate);
|
||||||
let fle = store.create(storeid).unwrap();
|
let fle = store.create(storeid).unwrap();
|
||||||
|
|
||||||
assert!(store.update(fle).is_err());
|
assert!(store.update(&mut fle).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2159,7 +2160,7 @@ aspect = "test"
|
||||||
let pb = pb.with_base(store.path().clone());
|
let pb = pb.with_base(store.path().clone());
|
||||||
|
|
||||||
assert!(store.entries.read().unwrap().get(&pb).is_some());
|
assert!(store.entries.read().unwrap().get(&pb).is_some());
|
||||||
assert!(store.update(fle).is_err());
|
assert!(store.update(&mut fle).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_store_with_allowed_error_hook_at_pos(pos: HP) -> Store {
|
fn get_store_with_allowed_error_hook_at_pos(pos: HP) -> Store {
|
||||||
|
@ -2198,7 +2199,7 @@ aspect = "test"
|
||||||
let store = get_store_with_allowed_error_hook_at_pos(HP::PreUpdate);
|
let store = get_store_with_allowed_error_hook_at_pos(HP::PreUpdate);
|
||||||
let fle = store.create(storeid).unwrap();
|
let fle = store.create(storeid).unwrap();
|
||||||
|
|
||||||
assert!(store.update(fle).is_ok());
|
assert!(store.update(&mut fle).is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2245,7 +2246,7 @@ aspect = "test"
|
||||||
let pb = pb.with_base(store.path().clone());
|
let pb = pb.with_base(store.path().clone());
|
||||||
|
|
||||||
assert!(store.entries.read().unwrap().get(&pb).is_some());
|
assert!(store.entries.read().unwrap().get(&pb).is_some());
|
||||||
assert!(store.update(fle).is_ok());
|
assert!(store.update(&mut fle).is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue