46 uint64_t request_entry_key;
54 struct Hash_Tree_node *parent;
59 struct Hash_Tree_node *parent,
68 struct Hash_Tree_node *child);
71 static inline struct Hash_Tree_node * Hash_Tree_node_get_parent(
struct Hash_Tree_node *node )
73 return node?node->parent:NULL;
76 static inline int Hash_Tree_node_get_child_count(
struct Hash_Tree_node *node )
81 static inline struct Hash_Tree_node * Hash_Tree_node_get_nth_child(
struct Hash_Tree_node *node,
int id )
87 struct Hash_Tree_node **ret = (
struct Hash_Tree_node **)
Chained_List_get_nth(&node->children,
id);
95 static inline void * Hash_Tree_node_payload(
struct Hash_Tree_node *node )
97 return node?node->payload:NULL;
100 static inline void * Hash_Tree_node_request(
struct Hash_Tree_node *node )
102 return node?node->request_entry:NULL;
110 #define HASH_TREE_NODE_COLL_AVOID 2
112 struct Hash_Tree_node_cell
115 struct Hash_Tree_node nodes[HASH_TREE_NODE_COLL_AVOID];
134 void Hash_Tree_init(
struct Hash_Tree *htr,
size_t request_size,
size_t payload_size );
140 struct Hash_Tree_node *
Hash_Tree_push(
struct Hash_Tree *htr,
void *parent_request,
void *new_request,
void *payload );
142 void Hash_Tree_walk(
struct Hash_Tree *htr,
void *starting_point_request,
void (*handler)(
void *,
void *),
void *extra_arg);
struct Hash_Tree_node * Hash_Tree_get_elem(struct Hash_Tree *htr, void *request)
void Hash_Tree_node_release(struct Hash_Tree_node *node)
void Hash_Tree_init(struct Hash_Tree *htr, size_t request_size, size_t payload_size)
size_t payload_size
the size of elements that can be stored in the list
This is the structure used to store the clusters (items that have the same hash)
static void * Chained_List_get_nth(struct Chained_List *list, uint64_t n)
Gets the nth element of the list.
void Hash_Tree_node_init(struct Hash_Tree_node *node, struct Hash_Tree_node *parent, void *request, size_t request_size, void *payload, size_t payload_size)
struct Hash_Tree_node * Hash_Tree_push(struct Hash_Tree *htr, void *parent_request, void *new_request, void *payload)
static uint64_t Chained_List_count(struct Chained_List *list)
Counts the elements in the list.
This a structure wrapps the use of chained_list This is the main chain list structure to use...
This is the main hask table structure.
void Hash_Tree_node_push_child(struct Hash_Tree_node *node, struct Hash_Tree_node *child)
volatile unsigned int MALP_Spinlock
The type of spinlocks in MALP.
int Hash_Tree_elem_exits(struct Hash_Tree *htr, void *request)
void Hash_Tree_walk(struct Hash_Tree *htr, void *starting_point_request, void(*handler)(void *, void *), void *extra_arg)
void Hash_Tree_release(struct Hash_Tree *htr, void(*free_func)(void *))