[btree] allow visitors to trap node access failures such as checksum error.

This commit is contained in:
Joe Thornber
2013-05-07 15:22:13 +01:00
parent 8e0271b3bf
commit 44d0b1903f
2 changed files with 35 additions and 0 deletions

View File

@ -760,6 +760,26 @@ void
btree<Levels, ValueTraits>::walk_tree(visitor &v,
node_location const &loc,
block_address b) const
{
try {
walk_tree_internal(v, loc, b);
} catch (std::runtime_error const &e) {
switch (v.error_accessing_node(loc, b, e.what())) {
case visitor::EXCEPTION_HANDLED:
break;
case visitor::RETHROW_EXCEPTION:
throw;
}
}
}
template <unsigned Levels, typename ValueTraits>
void
btree<Levels, ValueTraits>::walk_tree_internal(visitor &v,
node_location const &loc,
block_address b) const
{
using namespace btree_detail;