"Fossies" - the Fresh Open Source Software Archive

Member "haproxy-2.0.0/include/types/lb_fwrr.h" (16 Jun 2019, 1782 Bytes) of package /linux/misc/haproxy-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "lb_fwrr.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * include/types/lb_fwrr.h
    3  * Types for Fast Weighted Round Robin load balancing algorithm.
    4  *
    5  * Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
    6  *
    7  * This library is free software; you can redistribute it and/or
    8  * modify it under the terms of the GNU Lesser General Public
    9  * License as published by the Free Software Foundation, version 2.1
   10  * exclusively.
   11  *
   12  * This library is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15  * Lesser General Public License for more details.
   16  *
   17  * You should have received a copy of the GNU Lesser General Public
   18  * License along with this library; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   20  */
   21 
   22 #ifndef _TYPES_LB_FWRR_H
   23 #define _TYPES_LB_FWRR_H
   24 
   25 #include <common/config.h>
   26 #include <ebtree.h>
   27 
   28 /* This structure is used to apply fast weighted round robin on a server group */
   29 struct fwrr_group {
   30     struct eb_root curr;    /* tree for servers in "current" time range */
   31     struct eb_root t0, t1;  /* "init" and "next" servers */
   32     struct eb_root *init;   /* servers waiting to be placed */
   33     struct eb_root *next;   /* servers to be placed at next run */
   34     int curr_pos;           /* current position in the tree */
   35     int curr_weight;        /* total weight of the current time range */
   36     int next_weight;        /* total weight of the next time range */
   37 };
   38 
   39 struct lb_fwrr {
   40     struct fwrr_group act;  /* weighted round robin on the active servers */
   41     struct fwrr_group bck;  /* weighted round robin on the backup servers */
   42 };
   43 
   44 #endif /* _TYPES_LB_FWRR_H */
   45 
   46 /*
   47  * Local variables:
   48  *  c-indent-level: 8
   49  *  c-basic-offset: 8
   50  * End:
   51  */