Changeset 31025b4


Ignore:
Timestamp:
2008-07-14 13:59:10 (6 years ago)
Author:
Petter Knudsen <petter@…>
Branches:
2.0, 2.1, tags/varnish-2.0, tags/varnish-2.0-beta1, tags/varnish-2.0-beta1@3141, tags/varnish-2.0-beta2, tags/varnish-2.0-beta2@3221, tags/varnish-2.0-rc1, tags/varnish-2.0-rc1@3266, tags/varnish-2.0.1, tags/varnish-2.0.2, tags/varnish-2.0.3, tags/varnish-2.0.4, tags/varnish-2.0.5, tags/varnish-2.0.6, tags/varnish-2.1.0, tags/varnish-2.1.1, tags/varnish-2.1.2, tags/varnish-2.1.3, tags/varnish-2.1.4
Children:
545bd4
Parents:
8588af1
git-author:
Petter Knudsen <petter@…> (2008-07-14 13:59:10)
git-committer:
Petter Knudsen <petter@…> (2008-07-14 13:59:10)
Message:

Added a round robin director. The round robin director can be created like this:

director batman round-robin {

{ .backend = b1; }
{ .backend = b2; }
{ .backend = b3; }

}

sub vcl_recv {

set req.backend = batman;

}

The backend will then be chosen in a round robin fashion.

git-svn-id:  http://www.varnish-cache.org/svn/trunk@2943 d4fa192b-c00b-0410-8231-f00ffab90ce4

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/Makefile.am

    rc6caca r31025b4  
    1919        cache_cli.c \ 
    2020        cache_dir_random.c \ 
     21        cache_dir_round_robin.c \ 
    2122        cache_dir_simple.c \ 
    2223        cache_expire.c \ 
  • include/vrt.h

    ree39a2 r31025b4  
    9393 
    9494/* 
     95 * A director with round robin selection 
     96 */ 
     97 
     98struct vrt_dir_round_robin_entry { 
     99        const struct vrt_backend                *host; 
     100}; 
     101 
     102struct vrt_dir_round_robin { 
     103        const char                              *name; 
     104        unsigned                                nmember; 
     105        const struct vrt_dir_round_robin_entry  *members; 
     106}; 
     107 
     108 
     109/* 
    95110 * other stuff. 
    96111 * XXX: document when bored 
     
    148163void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *); 
    149164void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *); 
     165void VRT_init_dir_round_robin(struct cli *, struct director **, const struct vrt_dir_round_robin *); 
    150166void VRT_fini_dir(struct cli *, struct director *); 
    151167 
  • lib/libvcl/Makefile.am

    r9bb47f r31025b4  
    1515        vcc_compile.c \ 
    1616        vcc_dir_random.c \ 
     17        vcc_dir_round_robin.c \ 
    1718        vcc_parse.c \ 
    1819        vcc_fixed_token.c \ 
  • lib/libvcl/vcc_backend.c

    ree39a2 r31025b4  
    657657} dirlist[] = { 
    658658        { "random",     vcc_ParseRandomDirector }, 
     659        { "round-robin",        vcc_ParseRoundRobinDirector }, 
    659660        { NULL,         NULL } 
    660661}; 
  • lib/libvcl/vcc_compile.h

    r44fa98 r31025b4  
    179179parsedirector_f vcc_ParseRandomDirector; 
    180180 
     181/* vcc_dir_round_robin.c */ 
     182parsedirector_f vcc_ParseRoundRobinDirector; 
     183 
    181184/* vcc_obj.c */ 
    182185extern struct var vcc_vars[]; 
  • lib/libvcl/vcc_fixed_token.c

    ree39a2 r31025b4  
    431431        vsb_cat(sb, "\n"); 
    432432        vsb_cat(sb, "/*\n"); 
     433        vsb_cat(sb, " * A director with round robin selection\n"); 
     434        vsb_cat(sb, " */\n"); 
     435        vsb_cat(sb, "\n"); 
     436        vsb_cat(sb, "struct vrt_dir_round_robin_entry {\n"); 
     437        vsb_cat(sb, "   const struct vrt_backend                *host;\n"); 
     438        vsb_cat(sb, "};\n"); 
     439        vsb_cat(sb, "\n"); 
     440        vsb_cat(sb, "struct vrt_dir_round_robin {\n"); 
     441        vsb_cat(sb, "   const char                              *name;\n"); 
     442        vsb_cat(sb, "   unsigned                                nmember;\n"); 
     443        vsb_cat(sb, "   const struct vrt_dir_round_robin_entry  *members;\n"); 
     444        vsb_cat(sb, "};\n"); 
     445        vsb_cat(sb, "\n"); 
     446        vsb_cat(sb, "\n"); 
     447        vsb_cat(sb, "/*\n"); 
    433448        vsb_cat(sb, " * other stuff.\n"); 
    434449        vsb_cat(sb, " * XXX: document when bored\n"); 
     
    486501        vsb_cat(sb, "void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *);\n"); 
    487502        vsb_cat(sb, "void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *);\n"); 
     503        vsb_cat(sb, "void VRT_init_dir_round_robin(struct cli *, struct director **, const struct vrt_dir_round_robin *);\n"); 
    488504        vsb_cat(sb, "void VRT_fini_dir(struct cli *, struct director *);\n"); 
    489505        vsb_cat(sb, "\n"); 
Note: See TracChangeset for help on using the changeset viewer.