Exemplo n.º 1
0
static int _create_node(NID nid,
                        uint32_t height,
                        uint32_t children,
                        int version,
                        struct node **n,
                        struct env *e,
                        int light)
{
	struct node *new_node;

	if (light) {
		new_node = node_alloc_empty(nid, height, e);
		node_init_empty(new_node, children, version);
	} else {
		new_node = node_alloc_full(nid, height, children, version, e);
	}
	if (height > 0)
		status_increment(&e->status->tree_nonleaf_nums);
	else
		status_increment(&e->status->tree_leaf_nums);

	*n = new_node;

	return NESS_OK;
}
Exemplo n.º 2
0
/*
 * EFFECT:
 *	- alloc a full node: header + non/leaf infos
 */
struct node *node_alloc_full(NID nid, int height, int children, int layout_version) {
	struct node *node;

	node = node_alloc_empty(nid, height);
	node_init_empty(node, children, layout_version);
	node_ptrs_alloc(node);

	return node;
}