[validators] Move the btree node validator into a separate file.
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user