Commit 177b149a authored by Geoff Simmons's avatar Geoff Simmons

Reformat docs

parent 7767e77c
...@@ -137,71 +137,67 @@ BOOL create(PRIV_VCL, STRING, STRING, STRING, PROBE, STRING, DURATION, DURATION, ...@@ -137,71 +137,67 @@ BOOL create(PRIV_VCL, STRING, STRING, STRING, PROBE, STRING, DURATION, DURATION,
Prototype Prototype
BOOL create(PRIV_VCL, STRING name, STRING host, STRING port, PROBE probe, STRING host_header, DURATION connect_timeout, DURATION first_byte_timeout, DURATION between_bytes_timeout, INT max_connections) BOOL create(PRIV_VCL, STRING name, STRING host, STRING port, PROBE probe, STRING host_header, DURATION connect_timeout, DURATION first_byte_timeout, DURATION between_bytes_timeout, INT max_connections)
Description Create a backend with the given configuration. The parameters
Create a backend with the given configuration. The parameters correspond to the configuration fields of a static backend
correspond to the configuration fields of a static backend declaration. Further restrictions on required and optional parameters
declaration. Further restrictions on required and optional are given below.
parameters are given below.
``create()`` returns ``false`` if backend creation was unsuccessful,
``create()`` returns ``false`` if backend creation was ``true`` on success. After successful creation, the backend appears in
unsuccessful, ``true`` on success. After successful creation, the output of the CLI command ``backend.list``, and statistics in the
the backend appears in the output of the CLI command ``VBE.*`` namespace appear in the output of ``varnishstat``. Its
``backend.list``, and statistics in the ``VBE.*`` namespace health can be set with the CLI command ``backend.set_health``.
appear in the output of ``varnishstat``. Its health can be set
with the CLI command ``backend.set_health``. A backend created by the VMOD is "owned" by the VCL instance in which
it is created, and is not available in any other VCL loaded by the
A backend created by the VMOD is "owned" by the VCL instance Varnish process. The backend is deleted when its VCL is discarded, and
in which it is created, and is not available in any other VCL it enters the cooldown state when its VCL is set to cold; in
loaded by the Varnish process. The backend is deleted when its particular, no more health probes for that backend are performed, if
VCL is discarded, and it enters the cooldown state when its any were defined, when the backend goes cold.
VCL is set to cold; in particular, no more health probes for
that backend are performed, if any were defined, when the The parameters may be specified as named parameters in any order. If
backend goes cold. used without parameter names, they MUST appear strictly in the order
given in the function signature shown above.
The parameters may be specified as named parameters in any
order. If used without parameter names, they MUST appear
strictly in the order given in the function signature shown
above.
Required Parameters Required Parameters
The parameters ``name`` and ``host`` MUST be non-empty -------------------
strings. ``name`` MUST contain only alphanumeric characters
or the underscore. It MAY NOT be a name already used for The parameters ``name`` and ``host`` MUST be non-empty strings.
another backend created by the VMOD in the current instance of ``name`` MUST contain only alphanumeric characters or the
VCL, unless the backend with the duplicate name has been underscore. It MAY NOT be a name already used for another backend
deleted. created by the VMOD in the current instance of VCL, unless the backend
with the duplicate name has been deleted.
``host`` MUST be either an IP address (IPv4 or IPv6) or a host
name that can be resolved when ``create`` is called. A host ``host`` MUST be either an IP address (IPv4 or IPv6) or a host name
name may resolve to both an IPv4 and IPv6 address, but for that can be resolved when ``create`` is called. A host name may
each address family, it MUST resolve to exactly one address. resolve to both an IPv4 and IPv6 address, but for each address family,
it MUST resolve to exactly one address.
Optional Parameters Optional Parameters
``port`` MUST be a numeric port number, or a TCP service name -------------------
listed in ``/etc/services``. The default is ``"80"``.
``port`` MUST be a numeric port number, or a TCP service name listed
``probe`` MUST specify a probe defined in a static declaration in ``/etc/services``. The default is ``"80"``.
(or possibly a probe returned by another VMOD). If left
unspecified, the backend has no probe. ``probe`` MUST specify a probe defined in a static declaration (or
possibly a probe returned by another VMOD). If left unspecified, the
``host_header`` MUST be a non-empty legal value for the backend has no probe.
``Host`` header, and is sent as the ``Host`` header in backend
requests. By default, the value of the ``host`` parameter is ``host_header`` MUST be a non-empty legal value for the ``Host``
used for ``Host``. header, and is sent as the ``Host`` header in backend requests. By
default, the value of the ``host`` parameter is used for ``Host``.
Each of ``connect_timeout``, ``first_byte_timeout`` and
``between_bytes_timeout`` MUST be a VCL duration, such as Each of ``connect_timeout``, ``first_byte_timeout`` and
``0.5s``, ``1m``, etc. If a timeout is set for a specific ``between_bytes_timeout`` MUST be a VCL duration, such as ``0.5s``,
backend request (using ``bereq.connect_timeout``, etc.), then ``1m``, etc. If a timeout is set for a specific backend request (using
that timeout overrides the setting in the backend ``bereq.connect_timeout``, etc.), then that timeout overrides the
definition. If any of these parameters are left unspecified, setting in the backend definition. If any of these parameters are left
then the timeout "hierarchy" is followed as for standard unspecified, then the timeout "hierarchy" is followed as for standard
Varnish -- a ``bereq.*`` timeout is used if set, otherwise the Varnish -- a ``bereq.*`` timeout is used if set, otherwise the
corresponding global parameter is used (``-p corresponding global parameter is used (``-p connect_timeout``, etc.).
connect_timeout``, etc.).
``max_connections`` MUST be an integer. By default, there is no upper
``max_connections`` MUST be an integer. By default, there is bound for the connections to a backend.
no upper bound for the connections to a backend.
Examples:: Examples::
...@@ -223,23 +219,20 @@ BACKEND by_name(PRIV_VCL, STRING) ...@@ -223,23 +219,20 @@ BACKEND by_name(PRIV_VCL, STRING)
Prototype Prototype
BACKEND by_name(PRIV_VCL, STRING name) BACKEND by_name(PRIV_VCL, STRING name)
Description Return the backend created by the VMOD with the given name in the
Return the backend created by the VMOD with the given name in current instance of VCL. ``name`` MUST be the name of a backend
the current instance of VCL. ``name`` MUST be the name of a previously created with ``create()`` in the current VCL.
backend previously created with ``create()`` in the current
VCL.
``by_name()`` cannot return a statically declared backend, a ``by_name()`` cannot return a statically declared backend, a backend
backend deleted by ``delete()``, a backend owned by another deleted by ``delete()``, a backend owned by another VCL, or a backend
VCL, or a backend created by another VMOD. created by another VMOD.
The function returns ``NULL`` if no backend with the given The function returns ``NULL`` if no backend with the given name exists
name exists (or has been deleted). If this happens when (or has been deleted). If this happens when setting the value of
setting the value of ``req.backend_hint`` or ``bereq.backend``, ``req.backend_hint`` or ``bereq.backend``, the result is typically a
the result is typically a 503 response with the FetchError 503 response with the FetchError "No backend found".
"No backend found".
XXX: Document dir.add_backend(NULL) XXX: Document dir.add_backend(NULL)
Examples:: Examples::
...@@ -256,36 +249,32 @@ BOOL delete(PRIV_VCL, BACKEND) ...@@ -256,36 +249,32 @@ BOOL delete(PRIV_VCL, BACKEND)
Prototype Prototype
BOOL delete(PRIV_VCL, BACKEND be) BOOL delete(PRIV_VCL, BACKEND be)
Description Delete the backend created by the VMOD with the given name in the
Delete the backend created by the VMOD with the given name in current instance of VCL. ``name`` MUST be the name of a backend
the current instance of VCL. ``name`` MUST be the name of a previously created with ``create()`` in the current VCL.
backend previously created with ``create()`` in the current
VCL. After deletion, a backend is considered unhealthy and hence is o
longer selected for new backend requests. It enters a "cooldown" state
After deletion, a backend is considered unhealthy and hence is of at least 60 seconds, during which it may complete any requests that
no longer selected for new backend requests. It enters a had already begun when it was deleted. Any current backend requests
"cooldown" state of at least 60 seconds, during which it may MUST be completed during this time. The ``VBE.*`` statistics for the
complete any requests that had already begun when it was backend continue to appear in the output of ``varnishstat`` during
deleted. Any current backend requests MUST be completed cooldown, and ``MAIN.n_backend`` is not decremented until cooldown
during this time. The ``VBE.*`` statistics for the backend elapses.
continue to appear in the output of ``varnishstat`` during
cooldown, and ``MAIN.n_backend`` is not decremented until The backend no longer appears in the output of ``backend.list`` after
cooldown elapses. deletion, and its health cannot be set by ``backend.set_health``. It
is not returned by ``by_name()``, and cannot be used to set the value
The backend no longer appears in the output of of ``req.backend_hint`` or ``bereq.backend``. If the backend had been
``backend.list`` after deletion, and its health cannot be set previously added to a director, it is no longer selected by the
by ``backend.set_health``. It is not returned by director after deletion.
``by_name()``, and cannot be used to set the value of
``req.backend_hint`` or ``bereq.backend``. If the backend had ``delete()`` cannot delete a statically declared backend, a backend
been previously added to a director, it is no longer selected that has already been deleted, a backend owned by another VCL, or a
by the director after deletion. backend created by another VMOD.
``delete()`` cannot delete a statically declared backend, a ``delete()`` returns ``false`` if deletion was unsuccessful, ``true``
backend that has already been deleted, a backend owned by otherwise.
another VCL, or a backend created by another VMOD.
``delete()`` returns ``false`` if deletion was unsuccessful,
``true`` otherwise.
Examples:: Examples::
...@@ -301,8 +290,7 @@ STRING version() ...@@ -301,8 +290,7 @@ STRING version()
Prototype Prototype
STRING version() STRING version()
Description Returns the version string for this vmod.
Returns the version string for this vmod.
Example:: Example::
......
...@@ -112,71 +112,67 @@ $Function BOOL create(PRIV_VCL, STRING name, STRING host, STRING port="", ...@@ -112,71 +112,67 @@ $Function BOOL create(PRIV_VCL, STRING name, STRING host, STRING port="",
DURATION between_bytes_timeout=0, DURATION between_bytes_timeout=0,
INT max_connections=0) INT max_connections=0)
Description Create a backend with the given configuration. The parameters
Create a backend with the given configuration. The parameters correspond to the configuration fields of a static backend
correspond to the configuration fields of a static backend declaration. Further restrictions on required and optional parameters
declaration. Further restrictions on required and optional are given below.
parameters are given below.
``create()`` returns ``false`` if backend creation was unsuccessful,
``create()`` returns ``false`` if backend creation was ``true`` on success. After successful creation, the backend appears in
unsuccessful, ``true`` on success. After successful creation, the output of the CLI command ``backend.list``, and statistics in the
the backend appears in the output of the CLI command ``VBE.*`` namespace appear in the output of ``varnishstat``. Its
``backend.list``, and statistics in the ``VBE.*`` namespace health can be set with the CLI command ``backend.set_health``.
appear in the output of ``varnishstat``. Its health can be set
with the CLI command ``backend.set_health``. A backend created by the VMOD is "owned" by the VCL instance in which
it is created, and is not available in any other VCL loaded by the
A backend created by the VMOD is "owned" by the VCL instance Varnish process. The backend is deleted when its VCL is discarded, and
in which it is created, and is not available in any other VCL it enters the cooldown state when its VCL is set to cold; in
loaded by the Varnish process. The backend is deleted when its particular, no more health probes for that backend are performed, if
VCL is discarded, and it enters the cooldown state when its any were defined, when the backend goes cold.
VCL is set to cold; in particular, no more health probes for
that backend are performed, if any were defined, when the The parameters may be specified as named parameters in any order. If
backend goes cold. used without parameter names, they MUST appear strictly in the order
given in the function signature shown above.
The parameters may be specified as named parameters in any
order. If used without parameter names, they MUST appear
strictly in the order given in the function signature shown
above.
Required Parameters Required Parameters
The parameters ``name`` and ``host`` MUST be non-empty -------------------
strings. ``name`` MUST contain only alphanumeric characters
or the underscore. It MAY NOT be a name already used for The parameters ``name`` and ``host`` MUST be non-empty strings.
another backend created by the VMOD in the current instance of ``name`` MUST contain only alphanumeric characters or the
VCL, unless the backend with the duplicate name has been underscore. It MAY NOT be a name already used for another backend
deleted. created by the VMOD in the current instance of VCL, unless the backend
with the duplicate name has been deleted.
``host`` MUST be either an IP address (IPv4 or IPv6) or a host
name that can be resolved when ``create`` is called. A host ``host`` MUST be either an IP address (IPv4 or IPv6) or a host name
name may resolve to both an IPv4 and IPv6 address, but for that can be resolved when ``create`` is called. A host name may
each address family, it MUST resolve to exactly one address. resolve to both an IPv4 and IPv6 address, but for each address family,
it MUST resolve to exactly one address.
Optional Parameters Optional Parameters
``port`` MUST be a numeric port number, or a TCP service name -------------------
listed in ``/etc/services``. The default is ``"80"``.
``port`` MUST be a numeric port number, or a TCP service name listed
``probe`` MUST specify a probe defined in a static declaration in ``/etc/services``. The default is ``"80"``.
(or possibly a probe returned by another VMOD). If left
unspecified, the backend has no probe. ``probe`` MUST specify a probe defined in a static declaration (or
possibly a probe returned by another VMOD). If left unspecified, the
``host_header`` MUST be a non-empty legal value for the backend has no probe.
``Host`` header, and is sent as the ``Host`` header in backend
requests. By default, the value of the ``host`` parameter is ``host_header`` MUST be a non-empty legal value for the ``Host``
used for ``Host``. header, and is sent as the ``Host`` header in backend requests. By
default, the value of the ``host`` parameter is used for ``Host``.
Each of ``connect_timeout``, ``first_byte_timeout`` and
``between_bytes_timeout`` MUST be a VCL duration, such as Each of ``connect_timeout``, ``first_byte_timeout`` and
``0.5s``, ``1m``, etc. If a timeout is set for a specific ``between_bytes_timeout`` MUST be a VCL duration, such as ``0.5s``,
backend request (using ``bereq.connect_timeout``, etc.), then ``1m``, etc. If a timeout is set for a specific backend request (using
that timeout overrides the setting in the backend ``bereq.connect_timeout``, etc.), then that timeout overrides the
definition. If any of these parameters are left unspecified, setting in the backend definition. If any of these parameters are left
then the timeout "hierarchy" is followed as for standard unspecified, then the timeout "hierarchy" is followed as for standard
Varnish -- a ``bereq.*`` timeout is used if set, otherwise the Varnish -- a ``bereq.*`` timeout is used if set, otherwise the
corresponding global parameter is used (``-p corresponding global parameter is used (``-p connect_timeout``, etc.).
connect_timeout``, etc.).
``max_connections`` MUST be an integer. By default, there is no upper
``max_connections`` MUST be an integer. By default, there is bound for the connections to a backend.
no upper bound for the connections to a backend.
Examples:: Examples::
...@@ -192,23 +188,20 @@ Examples:: ...@@ -192,23 +188,20 @@ Examples::
$Function BACKEND by_name(PRIV_VCL, STRING name) $Function BACKEND by_name(PRIV_VCL, STRING name)
Description Return the backend created by the VMOD with the given name in the
Return the backend created by the VMOD with the given name in current instance of VCL. ``name`` MUST be the name of a backend
the current instance of VCL. ``name`` MUST be the name of a previously created with ``create()`` in the current VCL.
backend previously created with ``create()`` in the current
VCL.
``by_name()`` cannot return a statically declared backend, a ``by_name()`` cannot return a statically declared backend, a backend
backend deleted by ``delete()``, a backend owned by another deleted by ``delete()``, a backend owned by another VCL, or a backend
VCL, or a backend created by another VMOD. created by another VMOD.
The function returns ``NULL`` if no backend with the given The function returns ``NULL`` if no backend with the given name exists
name exists (or has been deleted). If this happens when (or has been deleted). If this happens when setting the value of
setting the value of ``req.backend_hint`` or ``bereq.backend``, ``req.backend_hint`` or ``bereq.backend``, the result is typically a
the result is typically a 503 response with the FetchError 503 response with the FetchError "No backend found".
"No backend found".
XXX: Document dir.add_backend(NULL) XXX: Document dir.add_backend(NULL)
Examples:: Examples::
...@@ -219,36 +212,32 @@ Examples:: ...@@ -219,36 +212,32 @@ Examples::
$Function BOOL delete(PRIV_VCL, BACKEND be) $Function BOOL delete(PRIV_VCL, BACKEND be)
Description Delete the backend created by the VMOD with the given name in the
Delete the backend created by the VMOD with the given name in current instance of VCL. ``name`` MUST be the name of a backend
the current instance of VCL. ``name`` MUST be the name of a previously created with ``create()`` in the current VCL.
backend previously created with ``create()`` in the current
VCL. After deletion, a backend is considered unhealthy and hence is o
longer selected for new backend requests. It enters a "cooldown" state
After deletion, a backend is considered unhealthy and hence is of at least 60 seconds, during which it may complete any requests that
no longer selected for new backend requests. It enters a had already begun when it was deleted. Any current backend requests
"cooldown" state of at least 60 seconds, during which it may MUST be completed during this time. The ``VBE.*`` statistics for the
complete any requests that had already begun when it was backend continue to appear in the output of ``varnishstat`` during
deleted. Any current backend requests MUST be completed cooldown, and ``MAIN.n_backend`` is not decremented until cooldown
during this time. The ``VBE.*`` statistics for the backend elapses.
continue to appear in the output of ``varnishstat`` during
cooldown, and ``MAIN.n_backend`` is not decremented until The backend no longer appears in the output of ``backend.list`` after
cooldown elapses. deletion, and its health cannot be set by ``backend.set_health``. It
is not returned by ``by_name()``, and cannot be used to set the value
The backend no longer appears in the output of of ``req.backend_hint`` or ``bereq.backend``. If the backend had been
``backend.list`` after deletion, and its health cannot be set previously added to a director, it is no longer selected by the
by ``backend.set_health``. It is not returned by director after deletion.
``by_name()``, and cannot be used to set the value of
``req.backend_hint`` or ``bereq.backend``. If the backend had ``delete()`` cannot delete a statically declared backend, a backend
been previously added to a director, it is no longer selected that has already been deleted, a backend owned by another VCL, or a
by the director after deletion. backend created by another VMOD.
``delete()`` cannot delete a statically declared backend, a ``delete()`` returns ``false`` if deletion was unsuccessful, ``true``
backend that has already been deleted, a backend owned by otherwise.
another VCL, or a backend created by another VMOD.
``delete()`` returns ``false`` if deletion was unsuccessful,
``true`` otherwise.
Examples:: Examples::
...@@ -258,8 +247,7 @@ Examples:: ...@@ -258,8 +247,7 @@ Examples::
$Function STRING version() $Function STRING version()
Description Returns the version string for this vmod.
Returns the version string for this vmod.
Example:: Example::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment