[PATCH] add documentation about backend naming for VMOD authors
geoff at uplex.de
Sun Nov 1 22:04:28 CET 2015
-----BEGIN PGP SIGNED MESSAGE-----
On 11/01/2015 07:01 PM, Dridi Boukelmoune wrote:
> We had sort-of started a discussion on IRC at some point about
> that, but there's no way AFAIK to enforce namespaces. This is why
> in this doc I suggest to back backends with a VMOD object, in order
> to get a vcl_name from the compiler and reuse it.
I should have pointed out that the doc-patch mentions the function
VCL_HasBackend(), which would come from another patch earlier in the
thread. So that part of the new docs should come if and when the code
patch is also added. VCL_HasBackend() tells you if a backend name is
already in use by a VCL.
The one object/one backend solution can help you with that as well,
but it depends on what you want your VMOD to do. I have a VMOD in the
works for creating new backends at runtime, and that won't work by
creating new objects for every backend, since objects can only be
created in vcl_init.
But it does have something similar to what you said, Dridi -- the VMOD
uses PRIV_VCL arguments to keep track of the backends that it created,
and then you can get the backends back (for req.backend_hint etc.)
with a function by_name("backend_name") that returns VCL_BACKEND.
** * * UPLEX - Nils Goroll Systemoptimierung
Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-----END PGP SIGNATURE-----
More information about the varnish-dev