#ifndef _HAPROXY_STICK_TABLE_T_H
#define _HAPROXY_STICK_TABLE_T_H
+#include <import/cebtree.h>
#include <import/ebtree-t.h>
#include <haproxy/api-t.h>
/* stick table */
struct stktable {
- char *id; /* local table id name. */
- size_t idlen; /* local table id name length. */
+ char *id; /* local table id name, indexed by <id_node> below. */
+ size_t idlen; /* local table id name length. */
char *nid; /* table id name sent over the network with peers protocol. */
struct stktable *next; /* The stick-table may be linked when belonging to
* the same configuration section.
*/
- struct ebpt_node name; /* Stick-table are lookup by name here. */
+ struct ceb_node id_node; /* Stick-table are lookup by name here, indexes <id> above. */
struct pool_head *pool; /* pool used to allocate sticky sessions */
struct task *exp_task; /* expiration task */
struct task *sync_task; /* sync task */
#include <string.h>
#include <errno.h>
+#include <import/cebis_tree.h>
#include <import/ebmbtree.h>
#include <import/ebsttree.h>
-#include <import/ebistree.h>
#include <haproxy/api.h>
#include <haproxy/applet.h>
static int (*smp_fetch_src)(const struct arg *, struct sample *, const char *, void *);
struct pool_head *pool_head_stk_ctr __read_mostly = NULL;
struct stktable *stktables_list;
-struct eb_root stktable_by_name = EB_ROOT;
+struct ceb_root *stktable_by_name = NULL;
#define round_ptr_size(i) (((i) + (sizeof(void *) - 1)) &~ (sizeof(void *) - 1))
*/
void stktable_store_name(struct stktable *t)
{
- t->name.key = t->id;
- ebis_insert(&stktable_by_name, &t->name);
+ cebis_item_insert(&stktable_by_name, id_node, id, t);
}
struct stktable *stktable_find_by_name(const char *name)
{
- struct ebpt_node *node;
- struct stktable *t;
-
- node = ebis_lookup(&stktable_by_name, name);
- if (node) {
- t = container_of(node, struct stktable, name);
- if (strcmp(t->id, name) == 0)
- return t;
- }
-
- return NULL;
+ return cebis_item_lookup(&stktable_by_name, id_node, id, name, struct stktable);
}
/*