[master] ffe4da2 After trying several different ways, rename vcl_hit{} to vcl_lookup{}, that seems to be the shortest path from A to B.

Poul-Henning Kamp phk at varnish-cache.org
Wed Apr 3 11:15:58 CEST 2013


commit ffe4da24efc15c9dae3888d912f2a263e0934086
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Apr 3 09:14:53 2013 +0000

    After trying several different ways, rename vcl_hit{} to vcl_lookup{},
    that seems to be the shortest path from A to B.
    
    (Please don't update docs yet, this is just a transition state)

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index fa9de50..03c8ce0 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -744,7 +744,7 @@ cnt_hit(struct worker *wrk, struct req *req)
 
 	assert(!(req->obj->objcore->flags & OC_F_PASS));
 
-	VCL_hit_method(req);
+	VCL_lookup_method(req);
 
 	if (req->handling == VCL_RET_DELIVER) {
 		//AZ(req->busyobj->bereq->ws);
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 2c61900..d6dfef0 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -530,7 +530,7 @@ VRT_purge(struct req *req, double ttl, double grace)
 {
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	if (req->cur_method == VCL_MET_HIT)
+	if (req->cur_method == VCL_MET_LOOKUP)
 		HSH_Purge(req, req->obj->objcore->objhead, ttl, grace);
 	else if (req->cur_method == VCL_MET_MISS)
 		HSH_Purge(req, req->objcore->objhead, ttl, grace);
diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl
index 986f276..a8432ab 100644
--- a/bin/varnishd/default.vcl
+++ b/bin/varnishd/default.vcl
@@ -93,7 +93,7 @@ sub vcl_hash {
     return (hash);
 }
 
-sub vcl_hit {
+sub vcl_lookup {
     return (deliver);
 }
 
diff --git a/bin/varnishtest/tests/c00010.vtc b/bin/varnishtest/tests/c00010.vtc
index 238dada..e9c78a9 100644
--- a/bin/varnishtest/tests/c00010.vtc
+++ b/bin/varnishtest/tests/c00010.vtc
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_hit {
+	sub vcl_lookup {
 		return(pass);
 	}
 } -start
diff --git a/bin/varnishtest/tests/c00033.vtc b/bin/varnishtest/tests/c00033.vtc
index 28b192d..a7782a1 100644
--- a/bin/varnishtest/tests/c00033.vtc
+++ b/bin/varnishtest/tests/c00033.vtc
@@ -23,7 +23,7 @@ varnish v1 -vcl+backend {
 		}
 	}
 
-	sub vcl_hit {
+	sub vcl_lookup {
 		if (req.method == "PURGE") {
 			C{ VRT_purge(req, 0, 0); }C
 			error 456 "got it";
diff --git a/bin/varnishtest/tests/c00041.vtc b/bin/varnishtest/tests/c00041.vtc
index c51cf53..e9dd2cd 100644
--- a/bin/varnishtest/tests/c00041.vtc
+++ b/bin/varnishtest/tests/c00041.vtc
@@ -40,7 +40,7 @@ server s1 {
 
 varnish v1 -vcl+backend {
 	sub vcl_miss { if (req.http.purge == "yes") { purge; } }
-	sub vcl_hit { if (req.http.purge == "yes") { purge; return(restart);} }
+	sub vcl_lookup { if (req.http.purge == "yes") { purge; return(restart);} }
 } -start
 
 client c1 {
diff --git a/bin/varnishtest/tests/p00001.vtc b/bin/varnishtest/tests/p00001.vtc
index ac95149..adfc1f0 100644
--- a/bin/varnishtest/tests/p00001.vtc
+++ b/bin/varnishtest/tests/p00001.vtc
@@ -24,7 +24,7 @@ client c1 {
 varnish v1 -stop
 
 varnish v1 -vcl+backend {
-	sub vcl_hit {
+	sub vcl_lookup {
 		set obj.ttl = 1 s;
 	}
 }
diff --git a/bin/varnishtest/tests/r00310.vtc b/bin/varnishtest/tests/r00310.vtc
index 6a5ce22..8097a6b 100644
--- a/bin/varnishtest/tests/r00310.vtc
+++ b/bin/varnishtest/tests/r00310.vtc
@@ -1,9 +1,9 @@
-varnishtest "Test obj.http.x-cache in vcl_hit"
+varnishtest "Test obj.http.x-cache in vcl_lookup"
 
-varnish v1 -errvcl {'obj.http.x-cache': cannot be set in method 'vcl_hit'.} {
+varnish v1 -errvcl {'obj.http.x-cache': cannot be set in method 'vcl_lookup'.} {
 	backend foo { .host = "localhost"; }
 
-	sub vcl_hit {
+	sub vcl_lookup {
 		set obj.http.x-cache = "hit";
 	}
 }
diff --git a/bin/varnishtest/tests/r00365.vtc b/bin/varnishtest/tests/r00365.vtc
index dc1d590..a703a66 100644
--- a/bin/varnishtest/tests/r00365.vtc
+++ b/bin/varnishtest/tests/r00365.vtc
@@ -1,4 +1,4 @@
-varnishtest "Test restarts in vcl_hit"
+varnishtest "Test restarts in vcl_lookup"
 
 server s1 {
 	rxreq
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_hit {
+	sub vcl_lookup {
 		set obj.ttl = 0s;
 		return (restart);
 	}
diff --git a/bin/varnishtest/tests/r00411.vtc b/bin/varnishtest/tests/r00411.vtc
index 67479d3..bab8eef 100644
--- a/bin/varnishtest/tests/r00411.vtc
+++ b/bin/varnishtest/tests/r00411.vtc
@@ -11,7 +11,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_hit {
+	sub vcl_lookup {
 		if (obj.http.X-Magic-Redirect == "1") {
 			set req.url = obj.http.Location;
 			return (restart);
diff --git a/bin/varnishtest/tests/r00412.vtc b/bin/varnishtest/tests/r00412.vtc
index 2b0082a..2d3c69a 100644
--- a/bin/varnishtest/tests/r00412.vtc
+++ b/bin/varnishtest/tests/r00412.vtc
@@ -19,7 +19,7 @@ varnish v1 -vcl+backend {
 			return (restart);
 		}
 	}
-	sub vcl_hit {
+	sub vcl_lookup {
 		if (obj.http.X-Magic-Redirect == "1") {
 			set req.url = obj.http.Location;
 			return (restart);
diff --git a/bin/varnishtest/tests/r00444.vtc b/bin/varnishtest/tests/r00444.vtc
index ad8e12a..85bdc15 100644
--- a/bin/varnishtest/tests/r00444.vtc
+++ b/bin/varnishtest/tests/r00444.vtc
@@ -25,7 +25,7 @@ varnish v1 -vcl+backend {
 			return (lookup);
 		}
 	}
-	sub vcl_hit {
+	sub vcl_lookup {
 		if (req.method == "POST") {
 			/* Get rid of this object */
 			set obj.ttl = 0s;
diff --git a/bin/varnishtest/tests/r00956.vtc b/bin/varnishtest/tests/r00956.vtc
index a41c25a..33e5198 100644
--- a/bin/varnishtest/tests/r00956.vtc
+++ b/bin/varnishtest/tests/r00956.vtc
@@ -11,7 +11,7 @@ varnish v1 -vcl+backend {
 		set req.http.foo = beresp.ttl;
 		set req.http.bar = "xxx";
 	}
-	sub vcl_hit {
+	sub vcl_lookup {
 		set req.http.foo = obj.ttl;
 		set obj.ttl = 7s;
 		set obj.grace = 120s;
diff --git a/bin/varnishtest/tests/r01113.vtc b/bin/varnishtest/tests/r01113.vtc
index 23ef6e0..5bf31c1 100644
--- a/bin/varnishtest/tests/r01113.vtc
+++ b/bin/varnishtest/tests/r01113.vtc
@@ -15,7 +15,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend {
-	sub vcl_hit {
+	sub vcl_lookup {
 		if (req.url == "/hit") {
 			return(restart);
 		}
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index 39d6eec..181e823 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -2,7 +2,7 @@ varnishtest "VCL compiler coverage test: vcc_action.c"
 
 varnish v1 -vcl {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_hit { return (restart) ; }
+	sub vcl_lookup { return (restart) ; }
 	sub vcl_miss { rollback; return (restart); }
 }
 
diff --git a/bin/varnishtest/tests/v00023.vtc b/bin/varnishtest/tests/v00023.vtc
index ca36194..10f9bb3 100644
--- a/bin/varnishtest/tests/v00023.vtc
+++ b/bin/varnishtest/tests/v00023.vtc
@@ -10,7 +10,7 @@ server s1 {
 } -start
 
 varnish v1 -vcl+backend { 
-	sub vcl_hit {
+	sub vcl_lookup {
 		set obj.ttl = 0s;
 		return (restart);
 	}
diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc
index e7b7675..a90c3a2 100644
--- a/bin/varnishtest/tests/v00025.vtc
+++ b/bin/varnishtest/tests/v00025.vtc
@@ -28,7 +28,7 @@ sub vcl_response {
 	}
 }
 
-sub vcl_hit {
+sub vcl_lookup {
 	if (obj.grace < 3m) {
 		set obj.grace = 1m;
 	} else {
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index af32e23..f5387d9 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -83,7 +83,7 @@ returns =(
 	('pass',	('error', 'restart', 'pass',)),
 	('hash',	('hash',)),
 	('miss',	('error', 'restart', 'pass', 'fetch',)),
-	('hit',		('error', 'restart', 'pass', 'deliver',)),
+	('lookup',	('error', 'restart', 'pass', 'deliver',)),
 	('fetch',	('error', 'fetch', 'pass',)),
 	('response',	('error', 'restart', 'deliver',)),
 	('deliver',	('restart', 'deliver',)),
@@ -389,8 +389,8 @@ sp_variables = (
 	),
 	('obj.proto',
 		'STRING',
-		( 'hit', 'error',),
-		( 'hit', 'error',),
+		( 'lookup', 'error',),
+		( 'lookup', 'error',),
 		'const struct req *'
 	),
 	('obj.status',
@@ -407,37 +407,37 @@ sp_variables = (
 	),
 	('obj.hits',
 		'INT',
-		( 'hit', 'deliver',),
+		( 'lookup', 'deliver',),
 		( ),
 		'const struct req *'
 	),
 	('obj.http.',
 		'HEADER',
-		( 'hit', 'error',),
+		( 'lookup', 'error',),
 		( 'error',),		# XXX ?
 		'const struct req *'
 	),
 	('obj.ttl',
 		'DURATION',
-		( 'hit', 'error',),
-		( 'hit', 'error',),
+		( 'lookup', 'error',),
+		( 'lookup', 'error',),
 		'struct req *'
 	),
 	('obj.grace',
 		'DURATION',
-		( 'hit', 'error',),
-		( 'hit', 'error',),
+		( 'lookup', 'error',),
+		( 'lookup', 'error',),
 		'struct req *'
 	),
 	('obj.keep',
 		'DURATION',
-		( 'hit', 'error',),
-		( 'hit', 'error',),
+		( 'lookup', 'error',),
+		( 'lookup', 'error',),
 		'struct req *'
 	),
 	('obj.lastuse',
 		'DURATION',
-		( 'hit', 'deliver', 'error',),
+		( 'lookup', 'deliver', 'error',),
 		( ),
 		'const struct req *'
 	),
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index de899cb..86d089b 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -372,7 +372,7 @@ static struct action_table {
 } action_table[] = {
 	{ "error",		parse_error,
 	    VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH |
-            VCL_MET_MISS | VCL_MET_HIT | VCL_MET_RESPONSE
+            VCL_MET_MISS | VCL_MET_LOOKUP | VCL_MET_RESPONSE
 	},
 
 #define VCL_RET_MAC(l, U, B)						\
@@ -390,7 +390,7 @@ static struct action_table {
 	{ "set",		parse_set },
 	{ "synthetic",		parse_synthetic, VCL_MET_ERROR },
 	{ "unset",		parse_unset },
-	{ "purge",		parse_purge, VCL_MET_MISS | VCL_MET_HIT },
+	{ "purge",		parse_purge, VCL_MET_MISS | VCL_MET_LOOKUP },
 	{ "new",		parse_new, VCL_MET_INIT},
 	{ NULL,			NULL }
 };



More information about the varnish-commit mailing list