era_check, era_dump

This commit is contained in:
Joe Thornber
2014-01-23 00:46:03 +00:00
parent bed0f369a8
commit 9e0540e1b6
19 changed files with 849 additions and 30 deletions

View File

@ -27,6 +27,8 @@ namespace {
namespace persistent_data {
namespace bitset_detail {
size_t BITS_PER_ULL = 64;
class bitset_impl {
public:
typedef boost::shared_ptr<bitset_impl> ptr;
@ -39,7 +41,7 @@ namespace persistent_data {
bitset_impl(tm_ptr tm, block_address root, unsigned nr_bits)
: nr_bits_(nr_bits),
array_(tm, rc_, root, nr_bits) {
array_(tm, rc_, root, nr_bits / BITS_PER_ULL) {
}
block_address get_root() const {

View File

@ -43,22 +43,6 @@ namespace persistent_data {
space_map::ptr sm_;
};
// FIXME: move to sep file. I don't think it's directly used by
// the btree code.
struct uint64_traits {
typedef base::le64 disk_type;
typedef uint64_t value_type;
typedef no_op_ref_counter<uint64_t> ref_counter;
static void unpack(disk_type const &disk, value_type &value) {
value = base::to_cpu<uint64_t>(disk);
}
static void pack(value_type const &value, disk_type &disk) {
disk = base::to_disk<base::le64>(value);
}
};
struct block_traits {
typedef base::le64 disk_type;
typedef block_address value_type;

View File

@ -0,0 +1,38 @@
#ifndef PERSISTENT_DATA_DATA_STRUCTURES_SIMPLE_TRAITS_H
#define PERSISTENT_DATA_DATA_STRUCTURES_SIMPLE_TRAITS_H
//----------------------------------------------------------------
namespace persistent_data {
struct uint64_traits {
typedef base::le64 disk_type;
typedef uint64_t value_type;
typedef no_op_ref_counter<uint64_t> ref_counter;
static void unpack(disk_type const &disk, value_type &value) {
value = base::to_cpu<uint64_t>(disk);
}
static void pack(value_type const &value, disk_type &disk) {
disk = base::to_disk<base::le64>(value);
}
};
struct uint32_traits {
typedef base::le32 disk_type;
typedef uint32_t value_type;
typedef no_op_ref_counter<uint32_t> ref_counter;
static void unpack(disk_type const &disk, value_type &value) {
value = base::to_cpu<uint32_t>(disk);
}
static void pack(value_type const &value, disk_type &disk) {
disk = base::to_disk<base::le32>(value);
}
};
}
//----------------------------------------------------------------
#endif