Re: trying to use ebtree to store key-value paires

From: Willy Tarreau <>
Date: Tue, 1 Nov 2011 23:34:03 +0100


On Tue, Nov 01, 2011 at 03:25:05PM +0800, wsq003 wrote:
> hi,
> I found ebtree works in a good manner, so want to use it in other places.
> Dose ebtree support key-value pair? I would like to use it to replace std::map at some specific condition.

it's mainly used for that. The principle is that you store a key in a node and you store this node into a larger struct which contains all your values. Then when you lookup the key, you find the node so you know the struct holding the key. That's how it's used in haproxy. Look at task.c for instance, the timer queue is scanned to wake up all tasks with an expired timer. The key here is the timer and the "value" is the task.

Willy Received on 2011/11/01 23:34

This archive was generated by hypermail 2.2.0 : 2011/11/01 23:45 CET