Mailing List Archive

r1551 - trunk/varnish-cache/lib/libvcl
Author: phk
Date: 2007-06-25 09:14:08 +0200 (Mon, 25 Jun 2007)
New Revision: 1551

Modified:
trunk/varnish-cache/lib/libvcl/vcc_compile.h
trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
trunk/varnish-cache/lib/libvcl/vcc_obj.c
Log:
Add bitmap of methods where they are valid to all objects.


Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2007-06-25 07:04:13 UTC (rev 1550)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2007-06-25 07:14:08 UTC (rev 1551)
@@ -121,6 +121,7 @@
const char *rname;
const char *lname;
unsigned has_string;
+ unsigned methods;
};

struct method {

Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2007-06-25 07:04:13 UTC (rev 1550)
+++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2007-06-25 07:14:08 UTC (rev 1551)
@@ -40,19 +40,45 @@
# Objects which operate on sessions

set spobj {
- { client.ip IP 1}
- { server.ip IP 1}
- { req.request STRING 1}
- { req.host STRING 1}
- { req.url STRING 1}
- { req.proto STRING 1}
- { req.backend BACKEND 0}
- { req.hash HASH 0}
- { obj.valid BOOL 0}
- { obj.cacheable BOOL 0}
- { obj.ttl TIME 0}
- { req.http. HEADER 1}
- { resp.http. HEADER 1}
+ { client.ip IP 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { server.ip IP 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.request STRING 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.host STRING 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.url STRING 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.proto STRING 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.backend BACKEND 0
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.http. HEADER 1
+ {recv pipe pass hash miss hit fetch}
+ }
+ { req.hash HASH 0
+ {hash}
+ }
+ { obj.valid BOOL 0
+ {hit fetch}
+ }
+ { obj.cacheable BOOL 0
+ {hit fetch}
+ }
+ { obj.ttl TIME 0
+ {hit fetch}
+ }
+ { resp.http. HEADER 1
+ {fetch}
+ }
}

set tt(IP) "struct sockaddr *"
@@ -85,6 +111,16 @@
set fp [open ../../include/vrt_obj.h w]
warns $fp

+proc method_map {m} {
+
+ set l ""
+ foreach i $m {
+ append l " | "
+ append l VCL_MET_[string toupper $i]
+ }
+ return [string range $l 3 end]
+}
+
proc vars {v ty pa} {
global tt fo fp

@@ -95,7 +131,8 @@
puts $fo "\t\{ \"$n\", $t, [string length $n],"
puts $fo "\t \"VRT_r_${m}($pa)\","
puts $fo "\t \"VRT_l_${m}($pa, \","
- puts $fo "\t [lindex $v 2]"
+ puts $fo "\t [lindex $v 2], "
+ puts $fo "\t [method_map [lindex $v 3]]"
puts $fo "\t\},"

puts $fp "$tt($t) VRT_r_${m}($ty);"

Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2007-06-25 07:04:13 UTC (rev 1550)
+++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2007-06-25 07:14:08 UTC (rev 1551)
@@ -13,17 +13,20 @@
{ "backend.host", HOSTNAME, 12,
"VRT_r_backend_host(backend)",
"VRT_l_backend_host(backend, ",
- 0
+ 0,
+
},
{ "backend.port", PORTNAME, 12,
"VRT_r_backend_port(backend)",
"VRT_l_backend_port(backend, ",
- 0
+ 0,
+
},
{ "backend.dnsttl", TIME, 14,
"VRT_r_backend_dnsttl(backend)",
"VRT_l_backend_dnsttl(backend, ",
- 0
+ 0,
+
},
{ NULL }
};
@@ -32,67 +35,80 @@
{ "client.ip", IP, 9,
"VRT_r_client_ip(sp)",
"VRT_l_client_ip(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "server.ip", IP, 9,
"VRT_r_server_ip(sp)",
"VRT_l_server_ip(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.request", STRING, 11,
"VRT_r_req_request(sp)",
"VRT_l_req_request(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.host", STRING, 8,
"VRT_r_req_host(sp)",
"VRT_l_req_host(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.url", STRING, 7,
"VRT_r_req_url(sp)",
"VRT_l_req_url(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.proto", STRING, 9,
"VRT_r_req_proto(sp)",
"VRT_l_req_proto(sp, ",
- 1
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
{ "req.backend", BACKEND, 11,
"VRT_r_req_backend(sp)",
"VRT_l_req_backend(sp, ",
- 0
+ 0,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
},
+ { "req.http.", HEADER, 9,
+ "VRT_r_req_http_(sp)",
+ "VRT_l_req_http_(sp, ",
+ 1,
+ VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH
+ },
{ "req.hash", HASH, 8,
"VRT_r_req_hash(sp)",
"VRT_l_req_hash(sp, ",
- 0
+ 0,
+ VCL_MET_HASH
},
{ "obj.valid", BOOL, 9,
"VRT_r_obj_valid(sp)",
"VRT_l_obj_valid(sp, ",
- 0
+ 0,
+ VCL_MET_HIT | VCL_MET_FETCH
},
{ "obj.cacheable", BOOL, 13,
"VRT_r_obj_cacheable(sp)",
"VRT_l_obj_cacheable(sp, ",
- 0
+ 0,
+ VCL_MET_HIT | VCL_MET_FETCH
},
{ "obj.ttl", TIME, 7,
"VRT_r_obj_ttl(sp)",
"VRT_l_obj_ttl(sp, ",
- 0
+ 0,
+ VCL_MET_HIT | VCL_MET_FETCH
},
- { "req.http.", HEADER, 9,
- "VRT_r_req_http_(sp)",
- "VRT_l_req_http_(sp, ",
- 1
- },
{ "resp.http.", HEADER, 10,
"VRT_r_resp_http_(sp)",
"VRT_l_resp_http_(sp, ",
- 1
+ 1,
+ VCL_MET_FETCH
},
{ NULL }
};