rename btree_validator to btree_checker

This commit is contained in:
Joe Thornber 2011-08-31 13:38:22 +01:00
parent dec79974b2
commit e408192b06
4 changed files with 19 additions and 19 deletions

View File

@ -1,5 +1,5 @@
#ifndef BTREE_VALIDATOR_H
#define BTREE_VALIDATOR_H
#ifndef BTREE_CHECKER_H
#define BTREE_CHECKER_H
#include "btree.h"
@ -65,9 +65,9 @@ namespace persistent_data {
// - leaf | internal flags (this can be inferred from siblings)
//----------------------------------------------------------------
template <uint32_t Levels, typename ValueTraits>
class btree_validator : public btree<Levels, ValueTraits>::visitor {
class btree_checker : public btree<Levels, ValueTraits>::visitor {
public:
btree_validator(block_counter &counter)
btree_checker(block_counter &counter)
: counter_(counter),
errs_(new error_set("btree errors")) {
}

View File

@ -1,6 +1,6 @@
#include "metadata.h"
#include "btree_validator.h"
#include "btree_checker.h"
#include "core_map.h"
#include <stdexcept>
@ -45,12 +45,12 @@ namespace {
// devices having mappings defined, which can later be cross
// referenced with the details tree. A separate block_counter is
// used to later verify the data space map.
class mapping_validator : public btree_validator<2, block_traits> {
class mapping_validator : public btree_checker<2, block_traits> {
public:
typedef boost::shared_ptr<mapping_validator> ptr;
mapping_validator(block_counter &metadata_counter, block_counter &data_counter)
: btree_validator<2, block_traits>(metadata_counter),
: btree_checker<2, block_traits>(metadata_counter),
data_counter_(data_counter) {
}
@ -59,7 +59,7 @@ namespace {
bool visit_internal_leaf(unsigned level, bool is_root,
btree_detail::node_ref<uint64_traits> const &n) {
bool r = btree_validator<2, block_traits>::visit_internal_leaf(level, is_root, n);
bool r = btree_checker<2, block_traits>::visit_internal_leaf(level, is_root, n);
if (!r && level == 0) {
throw runtime_error("unexpected sharing in level 0 of mapping tree.");
}
@ -72,7 +72,7 @@ namespace {
bool visit_leaf(unsigned level, bool is_root,
btree_detail::node_ref<block_traits> const &n) {
bool r = btree_validator<2, block_traits>::visit_leaf(level, is_root, n);
bool r = btree_checker<2, block_traits>::visit_leaf(level, is_root, n);
if (r)
for (unsigned i = 0; i < n.get_nr_entries(); i++)
@ -90,17 +90,17 @@ namespace {
set<uint64_t> devices_;
};
class details_validator : public btree_validator<1, device_details_traits> {
class details_validator : public btree_checker<1, device_details_traits> {
public:
typedef boost::shared_ptr<details_validator> ptr;
details_validator(block_counter &counter)
: btree_validator<1, device_details_traits>(counter) {
: btree_checker<1, device_details_traits>(counter) {
}
bool visit_leaf(unsigned level, bool is_root,
btree_detail::node_ref<device_details_traits> const &n) {
bool r = btree_validator<1, device_details_traits>::visit_leaf(level, is_root, n);
bool r = btree_checker<1, device_details_traits>::visit_leaf(level, is_root, n);
if (r)
for (unsigned i = 0; i < n.get_nr_entries(); i++)

View File

@ -109,12 +109,12 @@ namespace {
}
};
class ref_count_validator : public btree_validator<1, ref_count_traits> {
class ref_count_validator : public btree_checker<1, ref_count_traits> {
public:
typedef boost::shared_ptr<ref_count_validator> ptr;
ref_count_validator(block_counter &counter)
: btree_validator<1, ref_count_traits>(counter) {
: btree_checker<1, ref_count_traits>(counter) {
}
};
@ -307,21 +307,21 @@ namespace {
btree<1, ref_count_traits> ref_counts_;
};
class bitmap_tree_validator : public btree_validator<1, index_entry_traits> {
class bitmap_tree_validator : public btree_checker<1, index_entry_traits> {
public:
typedef boost::shared_ptr<bitmap_tree_validator> ptr;
bitmap_tree_validator(block_counter &counter)
: btree_validator<1, index_entry_traits>(counter) {
: btree_checker<1, index_entry_traits>(counter) {
}
bool visit_leaf(unsigned level, bool is_root,
btree_detail::node_ref<index_entry_traits> const &n) {
bool r = btree_validator<1, index_entry_traits>::visit_leaf(level, is_root, n);
bool r = btree_checker<1, index_entry_traits>::visit_leaf(level, is_root, n);
if (r)
for (unsigned i = 0; i < n.get_nr_entries(); i++)
btree_validator<1, index_entry_traits>::get_counter().inc(n.value_at(i).blocknr_);
btree_checker<1, index_entry_traits>::get_counter().inc(n.value_at(i).blocknr_);
return r;
}

View File

@ -1,7 +1,7 @@
#ifndef SPACE_MAP_DISK_H
#define SPACE_MAP_DISK_H
#include "btree_validator.h"
#include "btree_checker.h"
#include "space_map.h"
//----------------------------------------------------------------