Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-cluster
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-cluster
Commits
80abdc61
Unverified
Commit
80abdc61
authored
Jun 13, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use $Restrict
parent
a0138368
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
vmod_cluster.c
src/vmod_cluster.c
+5
-12
vmod_cluster.vcc
src/vmod_cluster.vcc
+19
-3
No files found.
src/vmod_cluster.c
View file @
80abdc61
...
...
@@ -314,13 +314,6 @@ vmod_cluster__fini(struct vmod_cluster_cluster **vcp)
}
#define cluster_methods (VCL_MET_INIT | VCL_MET_BACKEND_FETCH)
#define cluster_check(ctx, name, ret) do { \
if ((ctx->method & cluster_methods) == 0) { \
VRT_fail(ctx, \
"cluster." #name " can not be called here"); \
return ret; \
} \
} while(0)
VCL_VOID
vmod_cluster_deny
(
VRT_CTX
,
...
...
@@ -329,7 +322,7 @@ vmod_cluster_deny(VRT_CTX,
const
struct
vmod_cluster_cluster_param
*
pr
;
struct
vmod_cluster_cluster_param
*
pl
;
cluster_check
(
ctx
,
deny
,
);
AN
(
ctx
->
method
&
cluster_methods
);
CHECK_OBJ_NOTNULL
(
vc
,
VMOD_CLUSTER_CLUSTER_MAGIC
);
...
...
@@ -348,7 +341,7 @@ vmod_cluster_allow(VRT_CTX,
const
struct
vmod_cluster_cluster_param
*
pr
;
struct
vmod_cluster_cluster_param
*
pl
;
cluster_check
(
ctx
,
allow
,
);
AN
(
ctx
->
method
&
cluster_methods
);
CHECK_OBJ_NOTNULL
(
vc
,
VMOD_CLUSTER_CLUSTER_MAGIC
);
...
...
@@ -366,7 +359,7 @@ vmod_cluster_is_denied(VRT_CTX,
{
const
struct
vmod_cluster_cluster_param
*
pr
;
cluster_check
(
ctx
,
is_denied
,
0
);
AN
(
ctx
->
method
&
cluster_methods
);
CHECK_OBJ_NOTNULL
(
vc
,
VMOD_CLUSTER_CLUSTER_MAGIC
);
pr
=
cluster_task_param_r
(
ctx
,
vc
);
...
...
@@ -391,7 +384,7 @@ vmod_cluster_get_cluster(VRT_CTX, struct vmod_cluster_cluster *vc)
const struct vmod_cluster_cluster_param *pr; \
struct vmod_cluster_cluster_param *pl; \
\
cluster_check(ctx, set_ ## att,
); \
AN(ctx->method & cluster_methods
); \
\
CHECK_OBJ_NOTNULL(vc, VMOD_CLUSTER_CLUSTER_MAGIC); \
\
...
...
@@ -408,7 +401,7 @@ vmod_cluster_get_cluster(VRT_CTX, struct vmod_cluster_cluster *vc)
#define CLUSTER_R(ctx, vc, att, ret) \
const struct vmod_cluster_cluster_param *pr; \
\
cluster_check(ctx, get_ ## att, ret
); \
AN(ctx->method & cluster_methods
); \
\
CHECK_OBJ_NOTNULL(vc, VMOD_CLUSTER_CLUSTER_MAGIC); \
\
...
...
src/vmod_cluster.vcc
View file @
80abdc61
...
...
@@ -104,6 +104,8 @@ The :ref:`obj_cluster` object methods other than
:ref:`func_cluster.backend` behave differently depending on the
context they are being called from:
* Use is restricted to ``vcl_init{}`` and ``vcl_backend_fetch{}``.
* When used in ``vcl_init{}``, they change or return the director's
default.
...
...
@@ -115,9 +117,6 @@ context they are being called from:
irrespecitve of being called before or after the
:ref:`func_cluster.backend` method.
* Use in vcl subs other than ``vcl_init{}`` and
``vcl_backend_fetch{}`` is invalid and will trigger a VCL error.
:ref:`func_cluster.backend` has slightly different, specifically
documented limitations.
...
...
@@ -145,6 +144,8 @@ $Method VOID .deny(BACKEND)
Add a backend to the list of backends for which the cluster director
will resolve to a `real` backend (the blacklist).
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method VOID .allow(BACKEND)
...
...
@@ -152,6 +153,8 @@ $Method VOID .allow(BACKEND)
Remove a backend to the list of backends for which the cluster
director will resolve to a `real` backend (the blacklist).
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method BOOL .is_denied(BACKEND)
...
...
@@ -159,12 +162,16 @@ $Method BOOL .is_denied(BACKEND)
Return true if the argument is on list of backends for which the
cluster director will resolve to a `real` backend (the blacklist).
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method VOID .set_real(BACKEND)
Change the real backend.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method BACKEND .get_cluster()
...
...
@@ -175,6 +182,8 @@ $Method BACKEND .get_real()
Return the currently configured real backend.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method VOID .set_uncacheable_direct(BOOL)
...
...
@@ -184,12 +193,16 @@ for uncacheable backend requests (e.g. passes or cache lookups hitting
hit-for-pass). For a ``false`` argument, no difference is made with
regard to the cacheability of the backend request.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method BOOL .get_uncacheable_direct()
Return the currently configured behaviour.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method VOID .set_direct(BOOL)
...
...
@@ -199,11 +212,14 @@ always.
A ``false`` argument restores the original behavior.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
$Method BOOL .get_direct()
Return the current `direct` value as set with :ref:`func_cluster.get_direct`.
$Restrict vcl_init vcl_backend_fetch
See :ref:`meth_ctx` for limitations.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment