Data Fields | |
unsigned char | magic [4] |
File magic. | |
unsigned char | version [1] |
Format version. | |
unsigned char | nodetype [1] |
Indicates root node, backup root, etc. | |
unsigned char | level [1] |
Level within the tree. | |
unsigned char | extsz [1] |
Header extension size (CCN_BT_SIZE_UNITS). |
These are as they appear on external storage, so we stick to single-byte types to keep it portable between machines. Multi-byte numeric fields are always in big-endian format.
Within a node, the entries are fixed size. The entries are packed together at the end of the node's storage, so that by examining the last entry the location of the other entries can be determined directly. The entsz field includes the whole entry, which consists of a payload followed by a trailer.
The keys are stored in the first portion of the node. They may be in multiple pieces, and the pieces may overlap arbitrarily. This offers a very simple form of compression, since the keys within a node are very likely to have a lot in common with each other.
A few bytes at the very beginning serve as a header.
This is the overall structure of a node:
+---+-----------------------+--------------+----+----+-- --+----+ |hdr|..string......space....| (free space) | E0 | E1 | ... | En | +---+-----------------------+--------------+----+----+-- --+----+
It is designed so that new entries can be added without having to rewrite all of the string space. Thus the header should not contain things that we expect to change often.
Definition at line 170 of file btree.h.
unsigned char ccn_btree_node_header::magic[4] |
File magic.
Definition at line 171 of file btree.h.
Referenced by ccn_btree_chknode(), and ccn_btree_init_node().
unsigned char ccn_btree_node_header::version[1] |
Format version.
Definition at line 172 of file btree.h.
Referenced by ccn_btree_chknode(), and ccn_btree_init_node().
unsigned char ccn_btree_node_header::nodetype[1] |
unsigned char ccn_btree_node_header::level[1] |
Level within the tree.
Definition at line 174 of file btree.h.
Referenced by ccn_btree_chknode(), and ccn_btree_node_level().
unsigned char ccn_btree_node_header::extsz[1] |
Header extension size (CCN_BT_SIZE_UNITS).
Definition at line 175 of file btree.h.
Referenced by ccn_btree_chknode().