[validators] Move the btree node validator into a separate file.

This commit is contained in:
Joe Thornber
2015-08-11 11:58:07 +01:00
parent 5d28c05dc3
commit c32aaab028
5 changed files with 72 additions and 61 deletions

View File

@@ -22,6 +22,7 @@
#include "base/endian_utils.h"
#include "persistent-data/transaction_manager.h"
#include "persistent-data/data-structures/ref_counter.h"
#include "persistent-data/data-structures/btree_disk_structures.h"
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
@@ -61,36 +62,6 @@ namespace persistent_data {
using namespace base;
using namespace std;
uint32_t const BTREE_CSUM_XOR = 121107;
//------------------------------------------------
// On disk data layout for btree nodes
enum node_flags {
INTERNAL_NODE = 1,
LEAF_NODE = 1 << 1
};
struct node_header {
le32 csum;
le32 flags;
le64 blocknr; /* which block this node is supposed to live in */
le32 nr_entries;
le32 max_entries;
le32 value_size;
le32 padding;
} __attribute__((packed));
struct disk_node {
struct node_header header;
le64 keys[0];
} __attribute__((packed));
enum node_type {
INTERNAL,
LEAF
};
//------------------------------------------------
// Class that acts as an interface over the raw little endian btree
// node data.