Mailing List Archive

r1548 - in trunk/varnish-cache: bin/varnishd include lib/libvcl
Author: phk
Date: 2007-06-25 08:14:40 +0200 (Mon, 25 Jun 2007)
New Revision: 1548

Modified:
trunk/varnish-cache/bin/varnishd/mgt_vcc.c
trunk/varnish-cache/include/vcl.h
trunk/varnish-cache/include/vcl_returns.h
trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
Log:
Add vcl_discard{} method, which can return discard or pass actions.

This is for DES' work on LRU list.



Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-06-24 10:43:15 UTC (rev 1547)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-06-25 06:14:40 UTC (rev 1548)
@@ -127,6 +127,9 @@
" }\n"
" insert;\n"
"}\n"
+ "sub vcl_discard {\n"
+ " discard;\n"
+ "}\n"
"sub vcl_timeout {\n"
" discard;\n"
"}\n";

Modified: trunk/varnish-cache/include/vcl.h
===================================================================
--- trunk/varnish-cache/include/vcl.h 2007-06-24 10:43:15 UTC (rev 1547)
+++ trunk/varnish-cache/include/vcl.h 2007-06-25 06:14:40 UTC (rev 1548)
@@ -39,4 +39,5 @@
vcl_func_f *hit_func;
vcl_func_f *fetch_func;
vcl_func_f *timeout_func;
+ vcl_func_f *discard_func;
};

Modified: trunk/varnish-cache/include/vcl_returns.h
===================================================================
--- trunk/varnish-cache/include/vcl_returns.h 2007-06-24 10:43:15 UTC (rev 1547)
+++ trunk/varnish-cache/include/vcl_returns.h 2007-06-25 06:14:40 UTC (rev 1548)
@@ -40,5 +40,6 @@
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

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2007-06-24 10:43:15 UTC (rev 1547)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2007-06-25 06:14:40 UTC (rev 1548)
@@ -350,6 +350,7 @@
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 @@
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");

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2007-06-24 10:43:15 UTC (rev 1547)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2007-06-25 06:14:40 UTC (rev 1548)
@@ -42,6 +42,7 @@
{hit {error pass deliver}}
{fetch {error pass insert}}
{timeout {fetch discard}}
+ {discard {discard pass}}
}

# These are the return actions
r1548 - in trunk/varnish-cache: bin/varnishd include lib/libvcl [ In reply to ]
phk at projects.linpro.no writes:
> Log:
> Add vcl_discard{} method, which can return discard or pass actions.
>
> This is for DES' work on LRU list.
> [...]
> +VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_PASS))
> [...]
> + {discard {discard pass}}

Thanks! I have one question, though: what do you intend "pass" to mean
in the context of vcl_discard()? Perhaps we should add a "keep" keyword
instead?

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
r1548 - in trunk/varnish-cache: bin/varnishd include lib/libvcl [ In reply to ]
In message <87vedc1c9f.fsf at des.linpro.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=
writes:
>phk at projects.linpro.no writes:
>> Log:
>> Add vcl_discard{} method, which can return discard or pass actions.
>>
>> This is for DES' work on LRU list.
>> [...]
>> +VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_PASS))
>> [...]
>> + {discard {discard pass}}
>
>Thanks! I have one question, though: what do you intend "pass" to mean
>in the context of vcl_discard()? Perhaps we should add a "keep" keyword
>instead?

"pass on this one": ie: don't discard.

If people think "keep" is more intuitive I'll change it.


--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
r1548 - in trunk/varnish-cache: bin/varnishd include lib/libvcl [ In reply to ]
"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> Dag-Erling Sm?rgrav <des at linpro.no> writes:
> > Thanks! I have one question, though: what do you intend "pass" to
> > mean in the context of vcl_discard()? Perhaps we should add a
> > "keep" keyword instead?
> "pass on this one": ie: don't discard.
>
> If people think "keep" is more intuitive I'll change it.

I think "keep" would be better, since "pass" has a well-defined meaning
in other VCL contexts.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
r1548 - in trunk/varnish-cache: bin/varnishd include lib/libvcl [ In reply to ]
In message <87r6o01abj.fsf at des.linpro.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=
writes:
>"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
>> Dag-Erling Sm=C3=B8rgrav <des at linpro.no> writes:
>> > Thanks! I have one question, though: what do you intend "pass" to
>> > mean in the context of vcl_discard()? Perhaps we should add a
>> > "keep" keyword instead?
>> "pass on this one": ie: don't discard.
>>
>> If people think "keep" is more intuitive I'll change it.
>
>I think "keep" would be better, since "pass" has a well-defined meaning
>in other VCL contexts.

Done.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.