[PATCH] add documentation about backend naming for VMOD authors
Geoff Simmons
geoff at uplex.de
Mon Nov 2 01:32:31 CET 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 11/02/2015 12:42 AM, Poul-Henning Kamp wrote:
>
>>> But that reminds me: What was the consensus on my proposal for
>>> .%d suffix for colliding backend names ?
The previous conversation was just you and me talking, so I don't know
if we could call anything "consensus", but one point was that with the
suffix, VBE stats would exist for every backend. Otherwise, VBE stats
are only set up for one backend with a duplicated name, and all other
backends with the same name get no stats at all.
But on further consideration, could we always ensure that any backend
created by a VMOD might get the suffix if it needs to?
The message of the "Writing a Director" doc is that a VMOD creates a
struct director, never a struct backend. If you want it to be a
backend, then you leave the resolve function as NULL. An easy way to
do that is to use VRT_new_backend, which in turn calls VCL_AddBackend,
and that's where the suffix can be added if necessary.
But you don't have to do it that way. A VMOD author can set up
everything in a struct director, implementing all of the functions in
the interface (and connection pools, probes, stats, a listener for the
event function, the works; all of which are necessary for backends
that don't speak HTTP over TCP). Then these objects can be used for
everything you can do with VCL_BACKEND -- add it to a director, assign
it to req.backend_hint etc. -- with no other part of Varnish intervening.
In that case, the VMOD assigns a name to the vcl_name field; and it
can assign a suffix if it wants to, but I don't see any way to force it.
So unless we add a requirement like "you have to call VCL_Something()
to 'register' the director/backend", so that VCL_Something() can
change the name, I don't think we can use suffixes or anything else to
enforce unique names. (And as of now, I don't see why a VMOD backend
wouldn't work even if it doesn't call VCL_Something().)
Best,
Geoff
- --
** * * UPLEX - Nils Goroll Systemoptimierung
Scheffelstraße 32
22301 Hamburg
Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753
http://uplex.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJWNq8UAAoJEOUwvh9pJNURFNgP/1unx26k70cVmIEJ3Kh4oR1g
a0Aaevbp6gHBkPimlylNKSGHXGnNxzqHKKGT0dqhH6TjExGoH2CeBa+0J0uCRqN/
HMDEbq5wrk1zindR5dSPxoOl5X3YGXZ60sXSeHnNNBYy+VqvhvCctEEsFAL1Ri6k
+7SG+0QLF8XRm/cDW7lcLTlyzN5q3Z0cAEeVJ2ffMGIJQCsOG3/k2ilXI6ZXjohC
ePeyu5MsLhV7n3t59y/wwkhmDWV3RwUQUJDZBxprmncp/1CHrlkCSIws04Qej4kH
nFFKM7eH/GRHKzXKC28ctvMDwTpzROGKsRUVGEMif9+QGoCmWSe2S/E9doFiV5UH
KRSnVI8kAwIYALcy6SlPBnjb1a1aMGKpz6gnojUP3nWuDJd4nzsT/CgDfelkIcjS
ItzA79SPyJAp5I+OYUIEtKgImWEhP8vg5ojPLg9O43Z6PS4AQ1gVgK4boMlpDuam
u0p1PRTg4kxfWeoSd7hshZSCtEf0mcGn8F2MjtdapUExbOemyDmHyKSEEzvfxMof
tg9PFVQq+EpuWU2O1RvHyJuqHE6XNxVl2oGfnS/J1Sr+XCr07HI09BmxG+aLE5lP
I9LedqxdBTnZzjaz5OK4dSfNlRE/9fHWC3SzVpiAFiA47H0aDqxZTKHYJtN2yFMu
yQSijHqnQDi0rwQ2sNug
=qGV2
-----END PGP SIGNATURE-----
More information about the varnish-dev
mailing list