From 1e87e0699bf46afdf7de9e85f63cb16abaf172d0 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 25 Jun 2007 06:14:40 +0000 Subject: [PATCH] Add vcl_discard{} method, which can return discard or pass actions. This is for DES' work on LRU list. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1548 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/mgt_vcc.c | 3 +++ varnish-cache/include/vcl.h | 1 + varnish-cache/include/vcl_returns.h | 3 ++- varnish-cache/lib/libvcl/vcc_fixed_token.c | 11 +++++++---- varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/varnish-cache/bin/varnishd/mgt_vcc.c b/varnish-cache/bin/varnishd/mgt_vcc.c index c56c2e8c..6563b503 100644 --- a/varnish-cache/bin/varnishd/mgt_vcc.c +++ b/varnish-cache/bin/varnishd/mgt_vcc.c @@ -127,6 +127,9 @@ static const char *default_vcl = " }\n" " insert;\n" "}\n" + "sub vcl_discard {\n" + " discard;\n" + "}\n" "sub vcl_timeout {\n" " discard;\n" "}\n"; diff --git a/varnish-cache/include/vcl.h b/varnish-cache/include/vcl.h index c678a7f0..af7f75d0 100644 --- a/varnish-cache/include/vcl.h +++ b/varnish-cache/include/vcl.h @@ -39,4 +39,5 @@ struct VCL_conf { vcl_func_f *hit_func; vcl_func_f *fetch_func; vcl_func_f *timeout_func; + vcl_func_f *discard_func; }; diff --git a/varnish-cache/include/vcl_returns.h b/varnish-cache/include/vcl_returns.h index b3b057dd..6bc0e606 100644 --- a/varnish-cache/include/vcl_returns.h +++ b/varnish-cache/include/vcl_returns.h @@ -40,5 +40,6 @@ VCL_MET_MAC(miss,MISS,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_FETCH)) VCL_MET_MAC(hit,HIT,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_DELIVER)) VCL_MET_MAC(fetch,FETCH,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_INSERT)) VCL_MET_MAC(timeout,TIMEOUT,(VCL_RET_FETCH|VCL_RET_DISCARD)) +VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_PASS)) #endif -#define N_METHODS 8 +#define N_METHODS 9 diff --git a/varnish-cache/lib/libvcl/vcc_fixed_token.c b/varnish-cache/lib/libvcl/vcc_fixed_token.c index d91fda3d..2aa224c2 100644 --- a/varnish-cache/lib/libvcl/vcc_fixed_token.c +++ b/varnish-cache/lib/libvcl/vcc_fixed_token.c @@ -350,6 +350,7 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, " vcl_func_f *hit_func;\n"); vsb_cat(sb, " vcl_func_f *fetch_func;\n"); vsb_cat(sb, " vcl_func_f *timeout_func;\n"); + vsb_cat(sb, " vcl_func_f *discard_func;\n"); vsb_cat(sb, "};\n"); vsb_cat(sb, "/*-\n"); vsb_cat(sb, " * Copyright (c) 2006 Verdens Gang AS\n"); @@ -470,10 +471,12 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, "void VRT_l_req_proto(struct sess *, const char *);\n"); vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n"); - vsb_cat(sb, "double VRT_r_obj_valid(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, double);\n"); - vsb_cat(sb, "double VRT_r_obj_cacheable(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_cacheable(struct sess *, double);\n"); + vsb_cat(sb, "const char * VRT_r_req_hash(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n"); + vsb_cat(sb, "unsigned VRT_r_obj_valid(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, unsigned);\n"); + vsb_cat(sb, "unsigned VRT_r_obj_cacheable(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_cacheable(struct sess *, unsigned);\n"); vsb_cat(sb, "double VRT_r_obj_ttl(struct sess *);\n"); vsb_cat(sb, "void VRT_l_obj_ttl(struct sess *, double);\n"); vsb_cat(sb, "const char * VRT_r_req_http_(struct sess *);\n"); diff --git a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl index d956dda1..2ec2fa82 100755 --- a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl +++ b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl @@ -42,6 +42,7 @@ set methods { {hit {error pass deliver}} {fetch {error pass insert}} {timeout {fetch discard}} + {discard {discard pass}} } # These are the return actions -- 2.39.5