[array_walker] Read multiple array blocks at once
This commit is contained in:
parent
c17559791f
commit
3279d8381b
@ -53,29 +53,39 @@ impl<'a, V: Unpack + Copy> NodeVisitor<u64> for BlockValueVisitor<'a, V> {
|
|||||||
let mut errs: Vec<BTreeError> = Vec::new();
|
let mut errs: Vec<BTreeError> = Vec::new();
|
||||||
|
|
||||||
// TODO: check index continuity
|
// TODO: check index continuity
|
||||||
// FIXME: use IoEngine::read_many()
|
match self.engine.read_many(values) {
|
||||||
for (n, index) in keys.iter().enumerate() {
|
Err(_) => {
|
||||||
// FIXME: count read errors on its parent (BTreeError::IoError) or on its location
|
// IO completely failed on all the child blocks
|
||||||
// (ArrayError::IoError)?
|
// FIXME: count read errors on its parent (BTreeError::IoError) or on its location
|
||||||
let b = self.engine.read(values[n]).map_err(|_| btree::io_err(&path));
|
// (ArrayError::IoError)?
|
||||||
if let Err(e) = b {
|
for (_i, _b) in values.iter().enumerate() {
|
||||||
errs.push(e);
|
errs.push(btree::io_err(&path)); // FIXME: add key_context
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
let b = b.unwrap();
|
Ok(rblocks) => {
|
||||||
|
for (i, rb) in rblocks.into_iter().enumerate() {
|
||||||
path.push(values[n]);
|
match rb {
|
||||||
match unpack_array_block::<V>(&path, b.get_data()) {
|
Err(_) => {
|
||||||
Ok(array_block) => {
|
errs.push(btree::io_err(&path)); // FIXME: add key_context
|
||||||
if let Err(e) = self.array_visitor.visit(*index, array_block) {
|
},
|
||||||
self.array_errs.lock().unwrap().push(e);
|
Ok(b) => {
|
||||||
}
|
path.push(b.loc);
|
||||||
},
|
match unpack_array_block::<V>(&path, b.get_data()) {
|
||||||
Err(e) => {
|
Ok(array_block) => {
|
||||||
self.array_errs.lock().unwrap().push(e);
|
// FIXME: will the returned blocks be reordered?
|
||||||
|
if let Err(e) = self.array_visitor.visit(keys[i], array_block) {
|
||||||
|
self.array_errs.lock().unwrap().push(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
self.array_errs.lock().unwrap().push(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
path.pop();
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
path.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: duplicate to BTreeWalker::build_aggregrate()
|
// FIXME: duplicate to BTreeWalker::build_aggregrate()
|
||||||
|
Loading…
Reference in New Issue
Block a user