I need this out of the way to write a VIP on first-load and
last-discard events :)

Dridi
From c71438b946ba313f9155985fc4eff3f6ae6fb83f Mon Sep 17 00:00:00 2001
From: Dridi Boukelmoune <[email protected]>
Date: Mon, 4 Apr 2016 11:57:35 +0200
Subject: [PATCH] Retire VCL_EVENT_USE

It was decided during VDD15Q3 but this change didn't make it before the
4.1.0 release. It is kept in the 4.1 series but documented as deprecated
and can now be retired as discussed during VDD15Q4.
---
 bin/varnishd/cache/cache_vcl.c | 11 ++---------
 doc/sphinx/reference/vmod.rst  |  4 ----
 lib/libvcc/generate.py         |  1 -
 lib/libvcc/vcc_compile.c       | 23 +----------------------
 4 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index bfcba8b..26454a2 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -475,11 +475,10 @@ vcl_failsafe_event(VRT_CTX, enum vcl_event_e ev)
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	AN(ctx->handling);
 	AN(ctx->vcl);
-	assert(ev == VCL_EVENT_COLD || ev == VCL_EVENT_DISCARD ||
-	    ev == VCL_EVENT_USE);
+	assert(ev == VCL_EVENT_COLD || ev == VCL_EVENT_DISCARD);
 
 	if (ctx->vcl->conf->event_vcl(ctx, ev) != 0)
-		WRONG("A VMOD cannot fail USE, COLD or DISCARD events");
+		WRONG("A VMOD cannot fail COLD or DISCARD events");
 }
 
 static void
@@ -784,8 +783,6 @@ static void __match_proto__(cli_func_t)
 ccf_config_use(struct cli *cli, const char * const *av, void *priv)
 {
 	struct vcl *vcl;
-	struct vrt_ctx ctx;
-	unsigned hand = 0;
 
 	ASSERT_CLI();
 	AN(cli);
@@ -793,10 +790,6 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
 	vcl = vcl_find(av[2]);
 	AN(vcl);				// MGT ensures this
 	assert(vcl->temp == VCL_TEMP_WARM);	// MGT ensures this
-	INIT_OBJ(&ctx, VRT_CTX_MAGIC);
-	ctx.handling = &hand;
-	ctx.vcl = vcl;
-	vcl_failsafe_event(&ctx, VCL_EVENT_USE);
 	Lck_Lock(&vcl_mtx);
 	vcl_active = vcl;
 	Lck_Unlock(&vcl_mtx);
diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst
index d3271b5..208070a 100644
--- a/doc/sphinx/reference/vmod.rst
+++ b/doc/sphinx/reference/vmod.rst
@@ -426,10 +426,6 @@ In the case where properly releasing resources may take some time, you can
 opt for an asynchronous worker, either by spawning a thread and tracking it, or
 by using Varnish's worker pools.
 
-There is also a ``VCL_EVENT_USE`` event. Please note that this event is now
-deprecated and may be removed in a future release. A warm VCL should be ready
-to use so no additional task should be postponed at use time.
-
 When to lock, and when not to lock
 ==================================
 
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 44b8b2b..5efcff1 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -1027,7 +1027,6 @@ struct worker;
 enum vcl_event_e {
 	VCL_EVENT_LOAD,
 	VCL_EVENT_WARM,
-	VCL_EVENT_USE,
 	VCL_EVENT_COLD,
 	VCL_EVENT_DISCARD,
 };
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 2161cb7..0ee166d 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -326,8 +326,7 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb)
  * Init/Fini/Event
  *
  * We call DISCARD and COLD events in the opposite order of LOAD and
- * WARM. The child will panic if a USE event fails, since a WARM event
- * leads to a usable state.
+ * WARM.
  */
 
 static void
@@ -404,24 +403,6 @@ EmitInitFini(const struct vcc *tl)
 		Fc(tl, 0, "}\n");
 
 		/*
-		 * USE (deprecated)
-		 */
-		Fc(tl, 0, "\nstatic int\n");
-		Fc(tl, 0, "VGC_Use(VRT_CTX, enum vcl_event_e ev)\n{\n\n");
-
-		VTAILQ_FOREACH(p, &tl->inifin, list) {
-			assert(p->n > 0);
-			if (VSB_len(p->event)) {
-				Fc(tl, 0, "\t/* %u */\n", p->n);
-				Fc(tl, 0, "\tif (%s)\n", VSB_data(p->event));
-				Fc(tl, 0, "\t\treturn (1);\n\n");
-			}
-		}
-
-		Fc(tl, 0, "\treturn (0);\n");
-		Fc(tl, 0, "}\n");
-
-		/*
 		 * COLD
 		 */
 		Fc(tl, 0, "\nstatic int\n");
@@ -453,8 +434,6 @@ EmitInitFini(const struct vcc *tl)
 	if (has_event) {
 		Fc(tl, 0, "\tif (ev == VCL_EVENT_WARM)\n");
 		Fc(tl, 0, "\t\treturn(VGC_Warmup(ctx, ev));\n");
-		Fc(tl, 0, "\tif (ev == VCL_EVENT_USE)\n");
-		Fc(tl, 0, "\t\treturn(VGC_Use(ctx, ev));\n");
 		Fc(tl, 0, "\tif (ev == VCL_EVENT_COLD)\n");
 		Fc(tl, 0, "\t\treturn(VGC_Cooldown(ctx, ev));\n");
 	}
-- 
2.5.5

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to