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
52ff0015
Commit
52ff0015
authored
Mar 20, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add .real_selected
parent
cc2552ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
5 deletions
+56
-5
vmod_cluster.c
src/vmod_cluster.c
+45
-5
vmod_cluster.vcc
src/vmod_cluster.vcc
+11
-0
No files found.
src/vmod_cluster.c
View file @
52ff0015
...
...
@@ -609,8 +609,8 @@ vmod_cluster_backend(VRT_CTX,
return
(
cluster_choose
(
ctx
,
vc
,
res
,
NULL
,
carg
));
}
VCL_BOOL
vmod_cluster_cluster_selected
(
VRT_CTX
,
static
enum
decision_e
cluster_selected
(
VRT_CTX
,
const
char
*
func
,
struct
VPFX
(
cluster_cluster
)
*
vc
,
struct
VARGS
(
cluster_cluster_selected
)
*
arg
)
{
...
...
@@ -619,20 +619,60 @@ vmod_cluster_cluster_selected(VRT_CTX,
if
(
ctx
->
method
!=
VCL_MET_BACKEND_FETCH
)
{
VRT_fail
(
ctx
,
"cluster.
cluster_selected can not be called here"
);
return
(
0
);
"cluster.
%s can not be called here"
,
func
);
return
(
D_NULL
);
}
b
=
cluster_choose
(
ctx
,
vc
,
CLD
,
&
decision
,
arg
);
if
(
decision
==
D_NULL
||
b
==
NULL
)
return
(
0
);
return
(
D_NULL
);
assert
(
b
!=
vc
->
dir
);
VRT_l_bereq_backend
(
ctx
,
b
);
return
(
decision
);
}
VCL_BOOL
vmod_cluster_cluster_selected
(
VRT_CTX
,
struct
VPFX
(
cluster_cluster
)
*
vc
,
struct
VARGS
(
cluster_cluster_selected
)
*
arg
)
{
enum
decision_e
decision
;
decision
=
cluster_selected
(
ctx
,
"cluster_selected"
,
vc
,
arg
);
if
(
decision
==
D_NULL
)
return
(
0
);
return
(
decision
==
D_CLUSTER
);
}
VCL_BOOL
vmod_cluster_real_selected
(
VRT_CTX
,
struct
VPFX
(
cluster_cluster
)
*
vc
,
struct
VARGS
(
cluster_real_selected
)
*
arg
)
{
enum
decision_e
decision
;
struct
VARGS
(
cluster_cluster_selected
)
carg
[
1
]
=
{{
.
valid_deny
=
arg
->
valid_deny
,
.
valid_real
=
arg
->
valid_real
,
.
valid_uncacheable_direct
=
arg
->
valid_uncacheable_direct
,
.
deny
=
arg
->
deny
,
.
real
=
arg
->
real
,
.
uncacheable_direct
=
arg
->
uncacheable_direct
}};
decision
=
cluster_selected
(
ctx
,
"real_selected"
,
vc
,
carg
);
if
(
decision
==
D_NULL
)
return
(
0
);
return
(
decision
==
D_REAL
);
}
/*
* layered directors may not be prepared to resolve outside a VCL task, so when
* called from the cli (no method, no vcl), just return healthy if either the
...
...
src/vmod_cluster.vcc
View file @
52ff0015
...
...
@@ -250,6 +250,17 @@ in which case ``bereq.backend`` is not modified;
This method may only be called from ``vcl_backend_fetch {}`` and fail
the vcl otherwise.
$Method BOOL .real_selected(
[ BACKEND deny ], [ BACKEND real ],
[ BOOL uncacheable_direct ])
mirrors :ref:`func_cluster.cluster_selected`, but returns true if the
real backend is selected.
This is not exactly the negation because of the ``NULL`` backend case
for which both :ref:`func_cluster.cluster_selected` and
:ref:`func_cluster.real_selected` return ``false``.
SEE ALSO
========
vcl\(7),varnishd\(1)
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